vue router-link 上添加点击事件

根据Vue2.0官方文档关于父子组件通讯的原则,父组件通过prop传递数据给子组件,子组件触发事件给父组件。但父组件想在子组件上监听自己的click的话,需要加上native修饰符。

所以如果在想要在router-link上添加事件的话需要@click.native这样写

<router-link  :to="/user/age/10" @click.native="overTag(index)" @mouseover.native="overTag(index)" @mouseout.native="outTag(index)">
    Alan
</router-link>
原文地址:https://www.cnblogs.com/miangao/p/6830747.html