<script setup>
/* import { ref } from ‘vue’
const setupValue = ref(‘setup 示例内容1’) */
import { ref } from‘@vue/reactivity’
const count = ref(0)
const arr = ref([1, 2])
const handleCountChange = () => {
count.value++
}
const handleArrChange = () => {
// arr.value[0] = 10
// arr.value.push(1)
// arr.value = []
arr.value.length = 0
}
</script>
<template>
<divv-text=“count“/>
<button @click=“handleCountChange“>Number</button>
<divv-text=“arr“/>
<button @click=“handleArrChange“>Array</button>
</template>
<style>
</style>
<script setup>
/* import { ref } from ‘vue’
const setupValue = ref(‘setup 示例内容1’) */
import { ref } from‘@vue/reactivity’
const count = ref(0)
const arr = ref([1, 2])
const handleCountChange = () => {
count.value++
}
const handleArrChange = () => {
// arr.value[0] = 10
// arr.value.push(1)
// arr.value = []
arr.value.length = 0
}
</script>
<template>
<divv-text=“count“/>
<button @click=“handleCountChange“>Number</button>
<divv-text=“arr“/>
<button @click=“handleArrChange“>Array</button>
</template>
<style>
</style>
