LoginSignup
0
0

More than 3 years have passed since last update.

【Vue.js】v-onディレクティブの省略記法

Posted at
indx.html
<div id="app">
  <button v-on:click="clickHandler">
    click1
  </button>
  <button @click="clickHandler">
    click2
  </button>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
main.js
var app = new Vue({
    el: "#app",
  methods: {
    clickHandler: function() {
        alert('がんばれ')
    }
  }
})

v-on:clickでも@clickでもどちらでも大丈夫。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0