isRef
isRef方法通过vue解构出来
import {
isRef } from "vue";
主要是为了判断自己生成的响应数据是否是通过isRef 方法生成的
<template>
<div>
<p @click="isRefFun">{
{
refData.name }}</p>
</div>
</template>
<script>
import {
ref,isRef } from "vue";
export default {
name: "App",
setup() {
let refData = ref({
name:'zjq'})
function isRefFun() {
console.log('refData', isRef(refData)); //true
}
return {
refData,isRefFun}
},
};
</script>
isReactive
isReactive方法通过vue解构出来
import {
isReactive} from "vue";
主要是为了判断自己生成的响应数据是否是通过isReactive方法生成的
<template>
<div>
<p @click="isReactiveFun">{
{
reactiveData.name }}</p>
</div>
</template>
<script>
import {
reactive,isReactive } from "vue";
export default {
name: "App",
setup() {
let reactiveData = reactive({
name:'zjq'})
function isReactiveFun() {
console.log('reactiveData', isReactive(reactiveData));
}
return {
reactiveData,isReactiveFun}
},
};
</script>