bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
50 lines (44 loc) • 1.27 kB
JavaScript
import { Vue, mergeData } from '../../vue'
import { NAME_NAV_ITEM } from '../../constants/components'
import { PROP_TYPE_ARRAY_OBJECT_STRING, PROP_TYPE_OBJECT } from '../../constants/props'
import { omit, sortKeys } from '../../utils/object'
import { makeProp, makePropsConfigurable, pluckProps } from '../../utils/props'
import { BLink, props as BLinkProps } from '../link/link'
// --- Props ---
const linkProps = omit(BLinkProps, ['event', 'routerTag'])
export const props = makePropsConfigurable(
sortKeys({
...linkProps,
linkAttrs: makeProp(PROP_TYPE_OBJECT, {}),
linkClasses: makeProp(PROP_TYPE_ARRAY_OBJECT_STRING)
}),
NAME_NAV_ITEM
)
// --- Main component ---
// @vue/component
export const BNavItem = /*#__PURE__*/ Vue.extend({
name: NAME_NAV_ITEM,
functional: true,
props,
render(h, { props, data, listeners, children }) {
return h(
'li',
mergeData(omit(data, ['on']), {
staticClass: 'nav-item'
}),
[
h(
BLink,
{
staticClass: 'nav-link',
class: props.linkClasses,
attrs: props.linkAttrs,
props: pluckProps(linkProps, props),
on: listeners
},
children
)
]
)
}
})