65.vue2.0如何检测数组的变化

27 阅读1分钟

vue的obsever对数组做了单独处理

对数组的方法进行编译,并赋值给数组的__proto__属性上

编译方法会对数组的增加索引的方法(push,unshift,splice)等进行手动的obsever

push/pop/shift/unshift/sort/splice/reverse