關於 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 ,因為慢


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM