-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
breadcrumb-link.js
43 lines (38 loc) · 1.09 KB
/
breadcrumb-link.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { mergeData } from 'vue-functional-data-merge'
import Vue from '../../utils/vue'
import pluckProps from '../../utils/pluck-props'
import { htmlOrText } from '../../utils/html'
import { omit } from '../../utils/object'
import { BLink, props as BLinkProps } from '../link/link'
export const props = {
text: {
type: String,
default: null
},
html: {
type: String,
default: null
},
ariaCurrent: {
type: String,
default: 'location'
},
...omit(BLinkProps, ['event'])
}
// @vue/component
export const BBreadcrumbLink = /*#__PURE__*/ Vue.extend({
name: 'BBreadcrumbLink',
functional: true,
props,
render(h, { props: suppliedProps, data, children }) {
const tag = suppliedProps.active ? 'span' : BLink
const componentData = { props: pluckProps(props, suppliedProps) }
if (suppliedProps.active) {
componentData.attrs = { 'aria-current': suppliedProps.ariaCurrent }
}
if (!children) {
componentData.domProps = htmlOrText(suppliedProps.html, suppliedProps.text)
}
return h(tag, mergeData(data, componentData), children)
}
})