navbar-nav.js
1.09 KB
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
44
45
import { extend, mergeData } from '../../vue'
import { NAME_NAVBAR_NAV } from '../../constants/components'
import { pick } from '../../utils/object'
import { makePropsConfigurable } from '../../utils/props'
import { props as BNavProps } from '../nav/nav'
// --- Helper methods ---
const computeJustifyContent = value => {
value = value === 'left' ? 'start' : value === 'right' ? 'end' : value
return `justify-content-${value}`
}
// --- Props ---
export const props = makePropsConfigurable(
pick(BNavProps, ['tag', 'fill', 'justified', 'align', 'small']),
NAME_NAVBAR_NAV
)
// --- Main component ---
// @vue/component
export const BNavbarNav = /*#__PURE__*/ extend({
name: NAME_NAVBAR_NAV,
functional: true,
props,
render(h, { props, data, children }) {
const { align } = props
return h(
props.tag,
mergeData(data, {
staticClass: 'navbar-nav',
class: {
'nav-fill': props.fill,
'nav-justified': props.justified,
[computeJustifyContent(align)]: align,
small: props.small
}
}),
children
)
}
})