Skip to content
Permalink
Browse files

fix(b-link): only add the `nativeOn` property to componentData when r…

…endering a router link (#3976)
  • Loading branch information...
tmorehouse committed Aug 29, 2019
1 parent f3ec2a1 commit 62fb0b68aa059d5c827072f569026222eaa9ad4b
Showing with 10 additions and 7 deletions.
  1. +10 −7 src/components/link/link.js
@@ -153,10 +153,6 @@ export const BLink = /*#__PURE__*/ Vue.extend({
const href = this.computedHref
const isRouterLink = this.isRouterLink

// We want to overwrite any click handler since our callback
// will invoke the user supplied handler9s) if !props.disabled
const handlers = { ...this.$listeners, click: this.onClick }

const componentData = {
class: { active: this.active, disabled: this.disabled },
attrs: {
@@ -170,9 +166,16 @@ export const BLink = /*#__PURE__*/ Vue.extend({
: this.$attrs.tabindex,
'aria-disabled': this.disabled ? 'true' : null
},
props: this.computedProps,
on: isRouterLink ? {} : handlers,
nativeOn: isRouterLink ? handlers : {}
props: this.computedProps
}
// Add the event handlers. We must use `navtiveOn` for
// `<router-link>`/`<nuxt-link>` instead of `on`
componentData[isRouterLink ? 'nativeOn' : 'on'] = {
// Transfer all listeners (native) to the root element
...this.$listeners,
// We want to overwrite any click handler since our callback
// will invoke the user supplied handler(s) if `!this.disabled`
click: this.onClick
}

// If href attribute exists on <router-link> (even undefined or null) it fails working on

0 comments on commit 62fb0b6

Please sign in to comment.
You can’t perform that action at this time.