当前位置: 首页>前端>正文

vue3支持深层响应性​

<script setup>
import { ref, onMounted } from 'vue'
import './index.css'

const count = ref({
  num: 0,
})

const handleCount = () => {
  count.value.num++
  console.log(count)
}

onMounted(() => {
  console.log(1)
})
</script>

<template>
  <div class="m-home-wrap">
    <button @click="handleCount">{{ count.num }}</button>
    <div class="m-home-demo"></div>
  </div>
</template>

<style></style>

vue3支持深层响应性​,vue3支持深层响应性​_javascript,第1张

参考链接:

https://cn.vuejs.org/guide/essentials/reactivity-fundamentals.html


https://www.xamrdz.com/web/2r51960220.html

相关文章: