事件处理
<div id="basic-event" class="demo"> <button @click="counter += 1">Add 1</button> <p>The button above has been clicked {{ counter }} times.</p> </div>
.demo { font-family: sans-serif; border: 1px solid #eee; border-radius: 2px; padding: 20px 30px; margin-top: 1em; margin-bottom: 40px; user-select: none; overflow-x: auto; }
Vue.createApp({ data() { return { counter: 0 } } }).mount('#basic-event')