Difference from @click and v-on:click Vuejs

Difference from @click and v-on:click Vuejs

Asked on November 22, 2018 in vue.js.
Add Comment


  • 1 Answer(s)

    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'
    

    by the way:

    @click='someFunction'
    

    Another example:

    v-on:keyup='someKeyUpFunction'
    

    by way of:

    @keyup='someKeyUpFunction'
    

    Likewise, v-bind with:

    v-bind:href='var1'
    

    Can be inscribed as:

    :href='var1'
    
    Answered on November 22, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.