<template>
<div>
{{ count }}
<button @click.prevent="Add">Add</button>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
export default defineComponent({
name: 'VueTest',
setup() {
const count = ref(0);
function Add() {
count.value += 1
}
return {
count,
Add
};
}
});
</script>
vue3.x 之 ref
最新推荐文章于 2024-07-04 10:54:38 发布