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

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 ,因为慢
文章来自:http://www.cnblogs.com/vali/p/7825628.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3