super-fool / blog

珍藏经典, 分享思想, 共同进步.加油
3 stars 0 forks source link

Vue(一): Object.freeze() and v-once #28

Open super-fool opened 5 years ago

super-fool commented 5 years ago

freeze针对的是data. v-once针对的是component. 使用了freeze的对象,只有重新赋值才会改变。修改对象的值是没有用的。 使用了v-once的组件,修改对象和重新赋值都不会在该组件中改变,但是要记住对象是改变了,只不过没有在该组件中没有变化而已。