vuejs-challenges icon indicating copy to clipboard operation
vuejs-challenges copied to clipboard

7 - 原始值 API

Open PoliWen opened this issue 2 years ago • 0 comments

<script setup lang="ts">
import { reactive, isReactive, toRaw, markRaw} from "vue"

const state = { count: 1 }
const reactiveState = reactive(state)

/**
 * Modify the code so that we can make the output be true.
*/
console.log(toRaw(reactiveState) === state)

/**
 * Modify the code so that we can make the output be false.
*/
const info = markRaw({ count: 1 })
const reactiveInfo = reactive(info)

console.log(isReactive(reactiveInfo)) 

</script>

<template>
  <div>
    <p>
      {{ reactiveState.count }}
    </p>
  </div>
</template>

PoliWen avatar Sep 04 '22 13:09 PoliWen