Add event listener to component using “v-on:” directive - VueJS

后端 未结 2 604
长发绾君心
长发绾君心 2020-12-15 03:15

I\'m attempting to add a custom handler InlineButtonClickHandler to a component\'s click event, so that I can emit

相关标签:
2条回答
  • 2020-12-15 03:36

    You need to add the .native modifier:

    <router-link
        :to="to"
        @click.native="InlineButtonClickHandler"
    >
        {{name}}
    </router-link>
    

    This will listen to the native click event of the root element of the router-link component.

    0 讨论(0)
  • 2020-12-15 03:45
    <router-link:to="to">
        <span @click="InlineButtonClickHandler">{{name}}</span>
    </router-link>
    

    Maybe you can try this.

    0 讨论(0)
提交回复
热议问题