第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 Vue.set() 操作 store 中的數(shù)據(jù)報錯

使用 Vue.set() 操作 store 中的數(shù)據(jù)報錯

冉冉說 2018-12-13 18:14:47
在一個購物車列表中,購物車數(shù)據(jù)來自于 store, 我通過 vm.$set() 給數(shù)組每一項添加一個新的屬性 isChecked 來關(guān)聯(lián)每一項的選中狀態(tài)。computed: {      cartBooks: function() {        var carts = this.$store.getters.getCartBookList;        if (carts.length > 0) {          carts.forEach((item, index, array) => {            this.$set(item, 'isChecked', true);          });        } else {            this.isCheckedAll = false;        }        return carts;      }    }但是卻報錯:"Error: [vuex] Do not mutate vuex store state outside mutation handlers."請問是否因為 store 中的數(shù)據(jù)只能通過 mutations 方法來修改,但我在 mutation 之外又通過 vm.$set() 來修改了 store 中的數(shù)據(jù)才出現(xiàn)這種錯誤呢?這種錯誤要如何處理呢?
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 1206 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號