VUE3——isRef
isRef 用于判断是否用ref创建的响应式数据
isReactive 用于判断是否用reactive创建的响应式数据
isReadonly 用于判断是否用 readonly或shallowReadonly 包装过的数据
isProxy 用于判断是否是由 reactive或者readonly 创建的 代理的对象数据
let count = 10;
let num = ref(100);
let ruser = ref({ name:"zhangsan" });
let user = reactive({ name:"zhangsan" });
let obj = readonly(user);
let obj2 = shallowReadonly(user);
console.log(isRef(count)); //false
console.log(isRef(num)); //true
console.log(isRef(ruser)); //true
console.log("--------------------")
console.log(isReactive(count)); //false
console.log(isReactive(ruser)); //false
console.log(isReactive(user)); //true
console.log("--------------------")
console.log(isReadonly(user)); //false
console.log(isReadonly(obj)); //true
console.log(isReadonly(obj2)); //true
console.log("--------------------")
console.log(isProxy(num)); //false
console.log(isProxy(user)); //true
console.log(isProxy(ruser)); //false
console.log(isProxy(obj)); //true
console.log(isProxy(obj2)); //true
console.log("--------------------")