Skip to content

Commit 2e758af

Browse files
committed
Update link.js
1 parent 0788368 commit 2e758af

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/components/link/link.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { concat } from '../../utils/array'
1111
import { attemptBlur, attemptFocus, isTag } from '../../utils/dom'
1212
import { getRootEventName, stopEvent } from '../../utils/events'
1313
import { isBoolean, isEvent, isFunction, isUndefined } from '../../utils/inspect'
14-
import { sortKeys } from '../../utils/object'
14+
import { omit, sortKeys } from '../../utils/object'
1515
import { makeProp, makePropsConfigurable, pluckProps } from '../../utils/props'
1616
import { computeHref, computeRel, computeTag, isRouterLink } from '../../utils/router'
1717
import { attrsMixin } from '../../mixins/attrs'
@@ -98,14 +98,18 @@ export const BLink = /*#__PURE__*/ Vue.extend({
9898
return computeHref({ to, href }, this.computedTag)
9999
},
100100
computedProps() {
101-
const { prefetch } = this
101+
const { event, prefetch, routerTag } = this
102102
return this.isRouterLink
103103
? {
104-
...pluckProps({ ...routerLinkProps, ...nuxtLinkProps }, this),
105-
// Coerce `prefetch` value `null` to be `undefined`
106-
prefetch: isBoolean(prefetch) ? prefetch : undefined,
104+
...pluckProps(
105+
omit({ ...routerLinkProps, ...nuxtLinkProps }, ['event', 'prefetch', 'routerTag']),
106+
this
107+
),
108+
// Only add these props, when actually defined
109+
...(event ? { event } : {}),
110+
...(isBoolean(prefetch) ? { prefetch } : {}),
107111
// Pass `router-tag` as `tag` prop
108-
tag: this.routerTag
112+
...(routerTag ? { tag: routerTag } : {})
109113
}
110114
: {}
111115
},

0 commit comments

Comments
 (0)