-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Description
It looks like the click event on the <router-link> is handled before any custom click events:
<router-link to="/b" @click.native.prevent="clicked">should NOT route to b</router-link>
const app = new Vue({
router,
methods: {
clicked: function(e) {
// Does not prevent route change
e.preventDefault()
}
}
})
See working fiddle: https://jsfiddle.net/floorish/zhyqgqpz/
The <router-link> component checks e.defaultPrevented here : https://github.com/vuejs/vue-router/blob/dev/src/components/link.js#L49 , but that is still false when it checks the condition.
Only workaround I've found is to capture the event on a parent element (included in fiddle).
Vue version: 2.0.7
Vue-router version: 2.0.2
Possibly related to: #390
Metadata
Metadata
Assignees
Labels
No labels