vue中reactive,ref相关api总结

您所在的位置:网站首页 vue判断字符串为空 vue中reactive,ref相关api总结

vue中reactive,ref相关api总结

2024-07-07 09:53| 来源: 网络整理| 查看: 265

在vue3的composition api中的reactive和ref存在一些其他api。下面我们进行总结。 一、Reactive判断api isProxy:判断对象是否由reactive或者readonly创建的对象。

//判断reactive const info = reactive({ name: "dmc", age: 20 }); console.log(isProxy(info)) //true //判断readonly const info = readonly({ name: "dmc", age: 20 }); console.log(isProxy(info)) //true

isReactive:检查对象是否是reactive创建的响应式代理

const info = reactive({ name: "dmc", age: 20 }); console.log(isReactive(info)) //true //即使在readonly外层包裹reactive也是可以的。 const info = reactive({ name: "dmc", age: 20 }); console.log(isReactive(info)) //true //其代理为readonly创建的,但是其内部为reactive创建的,打印结果为true,反之为false. const info = reactive({ name:"zs"


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3