前端学习-vue学习003-事件监听
使用 v-on 指令监听 DOM 事件
<button v-on:click="increment">{{ count }}</button>
简写语法
<button @click="increment">{{ count }}</button>
<script setup>
import { ref } from 'vue'
const count = ref(0)
function increment() {
count.value += 1
}
</script>
<template>
<!-- 使此按钮生效 -->
<button @click = "increment">count is: {{ count }}</button>
</template>

浙公网安备 33010602011771号