VUE ref vs reactive API
两个函数都能用于创建reactive object, reactive 基于代理, ref基于属性setter和getter, ref是为了解决reactive的局限性而设计的
1 2 3 4 5 |
const count = ref({ xyz: 0 }) //count.xyz = 2; count.value.xyz = 2 console.log(count.xyz) |
如果使用ref 来创建某个对象的引用,赋值时只能使用ref.value.property,而不能直接ref.property
Comments are closed.