v-on内联JavaScript语句

v-on内联JavaScript语句
可以用内联 JavaScript 语句:
 
v-on
<div id="app">
  <button @click="say('hi')">Say hi</button>
  <button @click="say('what')">Say what</button>
</div>
 
<script>
const app = {
  data() {
   
  },
  methods: {
    say(message) {
      alert(message)
    }
  }
}
 
Vue.createApp(app).mount('#app')
</script>
 

推荐阅读