9
我有下面的吸氣劑:Vuex吸氣劑不更新
withEarmarks: state => {
var count = 0;
for (let l of state.laptops) {
if (l.earmarks.length > 0) {
count++;
}
}
return count;
}
而在一個部件,該計算屬性從吸氣劑衍生自:
withEarmarks() { return this.$store.getters.withEarmarks; },
返回的值是正確的,直到我改變元素在筆記本電腦陣列中,然後getter不會更新。
你是如何做的'laptops'數組中的變化,可以包含這些代碼。 – Saurabh
@saurabh我已經嘗試了這兩種方式:'state.laptops [index] = laptop;'和'state.laptops [index] = Object.assign({},laptop);' – daninthemix