4cd4fd28
郭伟龙
feat: 初始化项目
|
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
|
import { extend, mergeData } from '../../vue'
import { NAME_NAVBAR_BRAND } from '../../constants/components'
import { PROP_TYPE_STRING } 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'])
linkProps.href.default = undefined
linkProps.to.default = undefined
export const props = makePropsConfigurable(
sortKeys({
...linkProps,
tag: makeProp(PROP_TYPE_STRING, 'div')
}),
NAME_NAVBAR_BRAND
)
// --- Main component ---
// @vue/component
export const BNavbarBrand = /*#__PURE__*/ extend({
name: NAME_NAVBAR_BRAND,
functional: true,
props,
render(h, { props, data, children }) {
const isLink = props.to || props.href
const tag = isLink ? BLink : props.tag
return h(
tag,
mergeData(data, {
staticClass: 'navbar-brand',
props: isLink ? pluckProps(linkProps, props) : {}
}),
children
)
}
})
|