当利用索引直接设置一个项时,如
vm.items[indexOfItem] = newValue
vue 不能检测到变化的数组
可以用Vue.set方法,如
for(let item of this.items){ this.$set(item,'success',true); }
博客指出利用索引直接设置数组项时,Vue不能检测到数组变化,可使用Vue.set方法来解决这一问题。
当利用索引直接设置一个项时,如
vm.items[indexOfItem] = newValue
vue 不能检测到变化的数组
可以用Vue.set方法,如
for(let item of this.items){ this.$set(item,'success',true); }
转载于:https://my.oschina.net/u/2262481/blog/3073420
1043
3458
1769

被折叠的 条评论
为什么被折叠?