bootstrap-vue
Version:
BootstrapVue provides one of the most comprehensive implementations of Bootstrap 4 components and grid system for Vue.js and with extensive and automated WAI-ARIA accessibility markup.
34 lines (29 loc) • 758 B
JavaScript
import Link, { propsFactory } from '../link/link'
import { mergeData } from 'vue-functional-data-merge'
import pluckProps from '../../utils/pluck-props'
import { assign } from '../../utils/object'
const linkProps = propsFactory()
linkProps.href.default = undefined
linkProps.to.default = undefined
export const props = assign(linkProps, {
tag: {
type: String,
default: 'div'
}
})
export default {
functional: true,
props,
render (h, { props, data, children }) {
const isLink = Boolean(props.to || props.href)
const tag = isLink ? Link : props.tag
return h(
tag,
mergeData(data, {
staticClass: 'navbar-brand',
props: isLink ? pluckProps(linkProps, props) : {}
}),
children
)
}
}