current position:Home>Vue3 isProxy

Vue3 isProxy

2022-05-15 02:52:06* listen to the wind

isProxy:: Check whether an object is created by reactive perhaps readonly Method .

example :

<template>
  <p>The refNum is:{
    {
     refNum}}</p>
  <p>Is the refNum isProxy:{
    {
     isProRes1 }}</p>
  <p>The readNum is:{
    {
     readNum}}</p>
  <p>Is the readNum isProxy:{
    {
     isProRes2 }}</p>
  <p>The count.num is:{
    {
     count.num}}</p>
  <p>Is the count isProxy:{
    {
     isProRes3 }}</p>
</template>

<script lang="ts">
import {
     ref, reactive, readonly, isProxy } from 'vue'
export default {
    
  setup() {
    
    const refNum = ref(3)
    const readNum = readonly(refNum)
    const count = reactive({
    
      num: 5,
    })
    const isProRes1 = isProxy(refNum)
    const isProRes2 = isProxy(readNum)
    const isProRes3 = isProxy(count)
    return {
    
      refNum,
      readNum,
      count,
      isProRes1,
      isProRes2,
      isProRes3,
    }
  },
}
</script>

Page effects :
 Insert picture description here

copyright notice
author[* listen to the wind],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/132/202205120052508267.html

Random recommended