@@ -11,7 +11,7 @@ import { concat } from '../../utils/array'
11
11
import { attemptBlur, attemptFocus, isTag } from '../../utils/dom'
12
12
import { getRootEventName, stopEvent } from '../../utils/events'
13
13
import { isBoolean, isEvent, isFunction, isUndefined } from '../../utils/inspect'
14
-
import { sortKeys } from '../../utils/object'
14
+
import { omit, sortKeys } from '../../utils/object'
15
15
import { makeProp, makePropsConfigurable, pluckProps } from '../../utils/props'
16
16
import { computeHref, computeRel, computeTag, isRouterLink } from '../../utils/router'
17
17
import { attrsMixin } from '../../mixins/attrs'
@@ -29,11 +29,11 @@ const ROOT_EVENT_NAME_CLICKED = getRootEventName(NAME_LINK, 'clicked')
29
29
export const routerLinkProps = {
30
30
activeClass: makeProp(PROP_TYPE_STRING),
31
31
append: makeProp(PROP_TYPE_BOOLEAN, false),
32
-
event: makeProp(PROP_TYPE_ARRAY_STRING, EVENT_NAME_CLICK),
32
+
event: makeProp(PROP_TYPE_ARRAY_STRING),
33
33
exact: makeProp(PROP_TYPE_BOOLEAN, false),
34
34
exactActiveClass: makeProp(PROP_TYPE_STRING),
35
35
replace: makeProp(PROP_TYPE_BOOLEAN, false),
36
-
routerTag: makeProp(PROP_TYPE_STRING, 'a'),
36
+
routerTag: makeProp(PROP_TYPE_STRING),
37
37
to: makeProp(PROP_TYPE_OBJECT_STRING)
38
38
}
39
39
@@ -98,14 +98,18 @@ export const BLink = /*#__PURE__*/ Vue.extend({
98
98
return computeHref({ to, href }, this.computedTag)
99
99
},
100
100
computedProps() {
101
-
const { prefetch } = this
101
+
const { event, prefetch, routerTag } = this
102
102
return this.isRouterLink
103
103
? {
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 } : {}),
107
111
// Pass `router-tag` as `tag` prop
108
-
tag: this.routerTag
112
+
...(routerTag ? { tag: routerTag } : {})
109
113
}
110
114
: {}
111
115
},
@@ -127,7 +131,7 @@ export const BLink = /*#__PURE__*/ Vue.extend({
127
131
// (i.e. if `computedHref` is truthy)
128
132
...(href ? { href } : {}),
129
133
// We don't render `rel` or `target` on non link tags when using `vue-router`
130
-
...(isRouterLink && !isTag(routerTag, 'a') ? {} : { rel, target }),
134
+
...(isRouterLink && routerTag && !isTag(routerTag, 'a') ? {} : { rel, target }),
131
135
tabindex: disabled ? '-1' : isUndefined(bvAttrs.tabindex) ? null : bvAttrs.tabindex,
132
136
'aria-disabled': disabled ? 'true' : null
133
137
}
@@ -153,10 +157,10 @@ export const BLink = /*#__PURE__*/ Vue.extend({
153
157
// Needed to prevent `vue-router` for doing its thing
154
158
stopEvent(event, { immediatePropagation: true })
155
159
} else {
160
+
// Router links do not emit instance `click` events, so we
161
+
// add in an `$emit('click', event)` on its Vue instance
156
162
/* istanbul ignore next: difficult to test, but we know it works */
157
163
if (isRouterLink && event.currentTarget.__vue__) {
158
-
// Router links do not emit instance `click` events, so we
159
-
// add in an `$emit('click', event)` on its Vue instance
160
164
event.currentTarget.__vue__.$emit(EVENT_NAME_CLICK, event)
161
165
}
162
166
// Call the suppliedHandler(s), if any provided
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4