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.items
instead.
8:解决方法 如下图
7:不建议使用Json.parse ,因为慢