+110
-78
lines changedFilter options
+110
-78
lines changed Original file line number Diff line number Diff line change
@@ -231,7 +231,8 @@
231
231
"description": "router-link prop: Specify the event that triggers the link. In most cases you should leave this as the default"
232
232
},
233
233
"prefetch": {
234
-
"description": "nuxt-link prop: To improve the responsiveness of your Nuxt.js applications, when the link will be displayed within the viewport, Nuxt.js will automatically prefetch the code splitted page. Setting 'prefetch' to 'true' or 'false' will overwrite the default value of 'router.prefetchLinks'"
234
+
"description": "nuxt-link prop: To improve the responsiveness of your Nuxt.js applications, when the link will be displayed within the viewport, Nuxt.js will automatically prefetch the code splitted page. Setting 'prefetch' to 'true' or 'false' will overwrite the default value of 'router.prefetchLinks'",
235
+
"version": "2.15.0"
235
236
},
236
237
"noPrefetch": {
237
238
"description": "nuxt-link prop: To improve the responsiveness of your Nuxt.js applications, when the link will be displayed within the viewport, Nuxt.js will automatically prefetch the code splitted page. Setting 'no-prefetch' will disabled this feature for the specific link"
Original file line number Diff line number Diff line change
@@ -158,15 +158,18 @@ additional Nuxt.js specific props.
158
158
### `prefetch`
159
159
160
160
- type: `boolean`
161
-
- default: `undefined`
162
-
- availability: Nuxt.js 2.10.0+
161
+
- default: `null`
162
+
- availability: Nuxt.js 2.10.0+ and BootstrapVue 2.15.0+
163
163
164
164
To improve the responsiveness of your Nuxt.js applications, when the link will be displayed within
165
165
the viewport, Nuxt.js will automatically prefetch the code splitted page. Setting `prefetch` to
166
166
`true` or `false` will overwrite the default value of `router.prefetchLinks` configured in the
167
167
`nuxt.config.js` configuration file.
168
168
169
-
**Note:** If you have are using a version of Nuxt.js `< 2.10.0`, then this prop will have no effect.
169
+
**Notes:**
170
+
171
+
- If you have are using a version of Nuxt.js `< 2.10.0`, then this prop will have no effect.
172
+
- Remember to `v-bind` the prop value (e.g. `:prefetch="true"` or `:prefetch="false"`).
170
173
171
174
Prefetching support requires
172
175
[IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
1
1
import Vue from '../../utils/vue'
2
+
import pluckProps from '../../utils/pluck-props'
2
3
import { mergeData } from 'vue-functional-data-merge'
3
4
import { getComponentConfig } from '../../utils/config'
4
-
import pluckProps from '../../utils/pluck-props'
5
-
import { BLink, propsFactory as linkPropsFactory } from '../link/link'
5
+
import { clone } from '../../utils/object'
6
+
import { BLink, props as BLinkProps } from '../link/link'
6
7
7
8
const NAME = 'BBadge'
8
9
9
-
const linkProps = linkPropsFactory()
10
+
const linkProps = clone(BLinkProps)
10
11
delete linkProps.href.default
11
12
delete linkProps.to.default
12
13
13
14
export const props = {
14
-
...linkProps,
15
15
tag: {
16
16
type: String,
17
17
default: 'span'
@@ -23,7 +23,8 @@ export const props = {
23
23
pill: {
24
24
type: Boolean,
25
25
default: false
26
-
}
26
+
},
27
+
...linkProps
27
28
}
28
29
29
30
// @vue/component
Original file line number Diff line number Diff line change
@@ -2,10 +2,9 @@ import Vue from '../../utils/vue'
2
2
import { mergeData } from 'vue-functional-data-merge'
3
3
import pluckProps from '../../utils/pluck-props'
4
4
import { htmlOrText } from '../../utils/html'
5
-
import { BLink, propsFactory as linkPropsFactory } from '../link/link'
5
+
import { BLink, props as BLinkProps } from '../link/link'
6
6
7
7
export const props = {
8
-
...linkPropsFactory(),
9
8
text: {
10
9
type: String,
11
10
default: null
@@ -17,7 +16,8 @@ export const props = {
17
16
ariaCurrent: {
18
17
type: String,
19
18
default: 'location'
20
-
}
19
+
},
20
+
...BLinkProps
21
21
}
22
22
23
23
// @vue/component
Original file line number Diff line number Diff line change
@@ -6,14 +6,20 @@ import { concat } from '../../utils/array'
6
6
import { getComponentConfig } from '../../utils/config'
7
7
import { addClass, removeClass } from '../../utils/dom'
8
8
import { isBoolean, isEvent, isFunction } from '../../utils/inspect'
9
-
import { keys } from '../../utils/object'
9
+
import { clone } from '../../utils/object'
10
10
import { toString } from '../../utils/string'
11
-
import { BLink, propsFactory as linkPropsFactory } from '../link/link'
11
+
import { BLink, props as BLinkProps } from '../link/link'
12
12
13
-
// --- Constants --
13
+
// --- Constants ---
14
14
15
15
const NAME = 'BButton'
16
16
17
+
// --- Props ---
18
+
19
+
const linkProps = clone(BLinkProps)
20
+
delete linkProps.href.default
21
+
delete linkProps.to.default
22
+
17
23
const btnProps = {
18
24
block: {
19
25
type: Boolean,
@@ -55,12 +61,7 @@ const btnProps = {
55
61
}
56
62
}
57
63
58
-
const linkProps = linkPropsFactory()
59
-
delete linkProps.href.default
60
-
delete linkProps.to.default
61
-
const linkPropKeys = keys(linkProps)
62
-
63
-
export const props = { ...linkProps, ...btnProps }
64
+
export const props = { ...btnProps, ...linkProps }
64
65
65
66
// --- Helper methods ---
66
67
@@ -104,7 +105,7 @@ const computeClass = props => [
104
105
]
105
106
106
107
// Compute the link props to pass to b-link (if required)
107
-
const computeLinkProps = props => (isLink(props) ? pluckProps(linkPropKeys, props) : null)
108
+
const computeLinkProps = props => (isLink(props) ? pluckProps(linkProps, props) : null)
108
109
109
110
// Compute the attributes for a button
110
111
const computeAttrs = (props, data) => {
@@ -142,6 +143,7 @@ const computeAttrs = (props, data) => {
142
143
}
143
144
}
144
145
146
+
// --- Main component ---
145
147
// @vue/component
146
148
export const BButton = /*#__PURE__*/ Vue.extend({
147
149
name: NAME,
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
1
1
import Vue from '../../utils/vue'
2
2
import { requestAF } from '../../utils/dom'
3
+
import { clone } from '../../utils/object'
3
4
import attrsMixin from '../../mixins/attrs'
4
5
import normalizeSlotMixin from '../../mixins/normalize-slot'
5
-
import { BLink, propsFactory as linkPropsFactory } from '../link/link'
6
+
import { BLink, props as BLinkProps } from '../link/link'
6
7
7
-
export const props = linkPropsFactory()
8
+
export const props = clone(BLinkProps)
8
9
9
10
// @vue/component
10
11
export const BDropdownItem = /*#__PURE__*/ Vue.extend({
Original file line number Diff line number Diff line change
@@ -1,45 +1,17 @@
1
1
import Vue from '../../utils/vue'
2
+
import pluckProps from '../../utils/pluck-props'
2
3
import { concat } from '../../utils/array'
3
4
import { attemptBlur, attemptFocus } from '../../utils/dom'
4
-
import { isEvent, isFunction, isUndefined } from '../../utils/inspect'
5
+
import { isBoolean, isEvent, isFunction, isUndefined } from '../../utils/inspect'
5
6
import { computeHref, computeRel, computeTag, isRouterLink } from '../../utils/router'
6
-
import { omit } from '../../utils/object'
7
7
import attrsMixin from '../../mixins/attrs'
8
8
import listenersMixin from '../../mixins/listeners'
9
9
import normalizeSlotMixin from '../../mixins/normalize-slot'
10
10
11
-
/**
12
-
* The Link component is used in many other BV components
13
-
* As such, sharing its props makes supporting all its features easier
14
-
* However, some components need to modify the defaults for their own purpose
15
-
* Prefer sharing a fresh copy of the props to ensure mutations
16
-
* do not affect other component references to the props
17
-
*
18
-
* See: https://github.com/vuejs/vue-router/blob/dev/src/components/link.js
19
-
*/
20
-
export const propsFactory = () => ({
21
-
href: {
22
-
type: String,
23
-
default: null
24
-
},
25
-
rel: {
26
-
type: String,
27
-
// Must be `null` if no value provided
28
-
default: null
29
-
},
30
-
target: {
31
-
type: String,
32
-
default: '_self'
33
-
},
34
-
active: {
35
-
type: Boolean,
36
-
default: false
37
-
},
38
-
disabled: {
39
-
type: Boolean,
40
-
default: false
41
-
},
42
-
// <router-link> specific props
11
+
// --- Props ---
12
+
13
+
// <router-link> specific props
14
+
export const routerLinkProps = {
43
15
to: {
44
16
type: [String, Object],
45
17
default: null
@@ -71,29 +43,61 @@ export const propsFactory = () => ({
71
43
routerTag: {
72
44
type: String,
73
45
default: 'a'
74
-
},
75
-
// <nuxt-link> specific prop(s)
46
+
}
47
+
}
48
+
49
+
// <nuxt-link> specific props
50
+
export const nuxtLinkProps = {
76
51
prefetch: {
77
-
type: Boolean
78
-
// Must be `undefined` to fall back to the value defined in the
52
+
type: Boolean,
53
+
// Must be `null` to fall back to the value defined in the
79
54
// `nuxt.config.js` configuration file for `router.prefetchLinks`
80
-
// default: undefined
55
+
// We convert `null` to `undefined`, so that Nuxt.js will use the
56
+
// compiled default. Vue treats `undefined` as default of `false`
57
+
// for Boolean props, so we must set it as `null` here to be a
58
+
// true tri-state prop
59
+
default: null
81
60
},
82
61
noPrefetch: {
83
62
type: Boolean,
84
63
default: false
85
64
}
86
-
})
65
+
}
87
66
88
-
export const props = propsFactory()
67
+
export const props = {
68
+
href: {
69
+
type: String,
70
+
default: null
71
+
},
72
+
rel: {
73
+
type: String,
74
+
// Must be `null` if no value provided
75
+
default: null
76
+
},
77
+
target: {
78
+
type: String,
79
+
default: '_self'
80
+
},
81
+
active: {
82
+
type: Boolean,
83
+
default: false
84
+
},
85
+
disabled: {
86
+
type: Boolean,
87
+
default: false
88
+
},
89
+
...routerLinkProps,
90
+
...nuxtLinkProps
91
+
}
89
92
93
+
// --- Main component ---
90
94
// @vue/component
91
95
export const BLink = /*#__PURE__*/ Vue.extend({
92
96
name: 'BLink',
93
97
// Mixin order is important!
94
98
mixins: [attrsMixin, listenersMixin, normalizeSlotMixin],
95
99
inheritAttrs: false,
96
-
props: propsFactory(),
100
+
props,
97
101
computed: {
98
102
computedTag() {
99
103
// We don't pass `this` as the first arg as we need reactivity of the props
@@ -111,9 +115,16 @@ export const BLink = /*#__PURE__*/ Vue.extend({
111
115
return computeHref({ to: this.to, href: this.href }, this.computedTag)
112
116
},
113
117
computedProps() {
114
-
const props = this.isRouterLink ? { ...this.$props, tag: this.routerTag } : {}
115
-
// Ensure the `href` prop does not exist for router links
116
-
return this.computedHref ? props : omit(props, ['href'])
118
+
const prefetch = this.prefetch
119
+
return this.isRouterLink
120
+
? {
121
+
...pluckProps({ ...routerLinkProps, ...nuxtLinkProps }, this.$props),
122
+
// Coerce `prefetch` value `null` to be `undefined`
123
+
prefetch: isBoolean(prefetch) ? prefetch : undefined,
124
+
// Pass `router-tag` as `tag` prop
125
+
tag: this.routerTag
126
+
}
127
+
: {}
117
128
},
118
129
computedAttrs() {
119
130
const {
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
1
-
import Vue from '../../utils/vue'
2
1
import { mergeData } from 'vue-functional-data-merge'
2
+
import Vue from '../../utils/vue'
3
3
import pluckProps from '../../utils/pluck-props'
4
4
import { arrayIncludes } from '../../utils/array'
5
5
import { getComponentConfig } from '../../utils/config'
6
-
import { BLink, propsFactory as linkPropsFactory } from '../link/link'
6
+
import { clone } from '../../utils/object'
7
+
import { BLink, props as BLinkProps } from '../link/link'
8
+
9
+
// --- Constants ---
7
10
8
11
const NAME = 'BListGroupItem'
9
12
10
13
const actionTags = ['a', 'router-link', 'button', 'b-link']
11
-
const linkProps = linkPropsFactory()
14
+
15
+
// --- Props ---
16
+
17
+
const linkProps = clone(BLinkProps)
12
18
delete linkProps.href.default
13
19
delete linkProps.to.default
14
20
@@ -31,6 +37,8 @@ export const props = {
31
37
},
32
38
...linkProps
33
39
}
40
+
41
+
// --- Main component ---
34
42
// @vue/component
35
43
export const BListGroupItem = /*#__PURE__*/ Vue.extend({
36
44
name: NAME,
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
1
-
import Vue from '../../utils/vue'
2
1
import { mergeData } from 'vue-functional-data-merge'
3
-
import { BLink, propsFactory as linkPropsFactory } from '../link/link'
2
+
import Vue from '../../utils/vue'
3
+
import { clone } from '../../utils/object'
4
+
import { BLink, props as BLinkProps } from '../link/link'
5
+
6
+
// --- Props ---
4
7
5
-
export const props = linkPropsFactory()
8
+
export const props = clone(BLinkProps)
6
9
10
+
// --- Main component ---
7
11
// @vue/component
8
12
export const BNavItem = /*#__PURE__*/ Vue.extend({
9
13
name: 'BNavItem',
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
1
-
import Vue from '../../utils/vue'
2
1
import { mergeData } from 'vue-functional-data-merge'
2
+
import Vue from '../../utils/vue'
3
3
import pluckProps from '../../utils/pluck-props'
4
-
import { BLink, propsFactory } from '../link/link'
4
+
import { clone } from '../../utils/object'
5
+
import { BLink, props as BLinkProps } from '../link/link'
5
6
6
-
const linkProps = propsFactory()
7
+
const linkProps = clone(BLinkProps)
7
8
linkProps.href.default = undefined
8
9
linkProps.to.default = undefined
9
10
You can’t perform that action at this time.
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