其他分享
首页 > 其他分享> > Vue.js对象/数组变化检测总结

Vue.js对象/数组变化检测总结

作者:互联网

Vue.js对象/数组变化检测总结

可以被检测的操作:

const another = {x: 3, y: 4}
this.root1 = another
this.root3.a = 5

不能被检测的操作:

this.root3 = Object.assign({}, this.root3, {d: 4})  // 第一种方法,用Object.assign
this.$set(this.root3, 'd', 4)  // 第二种方法:用this.$set

参考:https://cn.vuejs.org/v2/guide/reactivity.html

标签:变化检测,Vue,another,对象,js,set,数组,root3
来源: https://blog.csdn.net/weixin_43012215/article/details/117136504