Difference between @click and v-on:click Vuejs

前端 未结 3 1454
时光说笑
时光说笑 2021-01-30 05:37

the questions should be enough clear :). But I can see that someone use:

Someone use:

3条回答
  •  余生分开走
    2021-01-30 06:17

    v-bind and v-on are two frequently used directives in vuejs html template. So they provided a shorthand notation for the both of them as follows:

    You can replace v-on: with @

    v-on:click='someFunction'
    

    as:

    @click='someFunction'
    

    Another example:

    v-on:keyup='someKeyUpFunction'
    

    as:

    @keyup='someKeyUpFunction'
    

    Similarly, v-bind with :

    v-bind:href='var1'
    

    Can be written as:

    :href='var1'
    

    Hope it helps!

提交回复
热议问题