首页 > 其他 > 详细

关于 vuex 报错 Do not mutate vuex store state outside mutation handlers.

时间:2017-11-13 12:58:50      阅读:2191      评论:0      收藏:0      [点我收藏+]

10 :问题描述

在使用vuex 时,有时候 我们在mutation中定义好方法,在页面或组件提交时

有可能经常会遇到这个错误:---->>Do not mutate vuex store state outside mutation handlers.

9. 原因:

The reason is that arrays are stored as references in Javascript and payload.items is likely to be changed outside Vuex. So we should just use a fresh copy of payload.itemsinstead.

8:解决方法 如下图

技术分享

 

7:不建议使用Json.parse ,因为慢

关于 vuex 报错 Do not mutate vuex store state outside mutation handlers.

原文:http://www.cnblogs.com/vali/p/7825628.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!