1、ref 深拷贝 视图层更新不改变源数据
const num = 1 const refNum = ref(num) const click = ()=>{ refNum++ //refNum 已经改变了,但原数据num不变 }
2、toRef 源数据改变不更新视图
3、toRefs 传入一个响应式对象
const obj =reactive{name:"iwen",age:19}//取值为obj.name return (...toRefs(obj))//取值为name age
标签:obj,name,视图,refNum,num,vue3,const From: https://www.cnblogs.com/iwen1992/p/17592359.html