https://ykrkz6k081.sse.codesandbox.io/
<template><a href="https://google.com"
@click.prevent
@click.middle.prevent.stop="goto"
>Should not open with
middle click</a>
<script>
methiods:{
goto(e){
e.preventDefault();
return false
}
should block middle click from opening in new tab
Chrome opens link in new tab.
Left click works correctly (is blocking with .prevent). Middle isn't;
Link to editor of codesandbox https://codesandbox.io/s/ykrkz6k081?fontsize=14
Hello @ambrt seems like this is an issue specifically within the Vue.js. I'll open a PR with the Vue team. A workaround for this would be to set it to this @auxclick.prevent.stop='goto' instead of listening to the @click, I hope this helps you. 馃槃
@asg5704 Thanks, it works馃槂 . Btw,is @auxclick something internal in Vue? I couldn't find anything in docs about it. (I'm closing issue but still curious )
@ambrt, No it is not in the Vue docs.
auxclick is the name of the event supported by browsers - https://developer.mozilla.org/en-US/docs/Web/API/Element/auxclick_event
It doesn't need to be listed in Vue docs as Vue can handle any arbitrarily named event, this one just being one of them.