VueJS: @click.native.stop = “” possible?

拈花ヽ惹草 提交于 2019-12-06 05:10:42

Did you check the manual? https://vuejs.org/v2/guide/events.html

There is @click.stop="" or @click.stop.prevent=""

So you don't need to use this

methods: {
    clickHandler(e) {
      e.stopPropagation();
      console.log(e);
    }
  }

I had the same problem. I fixed the issue by using following:

<MyComponent @click.native.prevent="myFunction(params)" />

In the Vue, modifiers can be chained. So, you are free to use modifiers like this:

@click.native.prevent or @click.stop.prevent

<my-component @click.native.prevent="doSomething"></my-component>

Check events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!