-
引用对象数据更新而视图未更新
-
数组
-
由于JavaScript的限制(具体什么待学习)Vue不能检测利用索引直接设置一个项,例如arr[1] = ['a'];修改数组长度时,例如arr.length = 2。第一种问题可以使用this.$set(arr,1,newValue)或者this.arr.splice(index,1,newValue);第二种问题使用this.arr.splice(newLength)
-
-
对象
-
Vue不能检测对象属性的添加或者删除。this.$set(this.obj, 'age', 27)
-
-
-
使用持久化存储,不能直接通过this.$store.state直接修改,改为使用vuex的方式
转载于:https://juejin.im/post/5c8651caf265da2da15df496