1- import { Vue } from '../../vue'
1+ import { Vue , mergeData } from '../../vue'
22import { NAME_BADGE } from '../../constants/components'
33import { PROP_TYPE_BOOLEAN , PROP_TYPE_STRING } from '../../constants/props'
44import { omit , sortKeys } from '../../utils/object'
55import { makeProp , makePropsConfigurable , pluckProps } from '../../utils/props'
66import { isLink } from '../../utils/router'
7- import { normalizeSlotMixin } from '../../mixins/normalize-slot'
87import { BLink , props as BLinkProps } from '../link/link'
98
109// --- Props ---
@@ -28,28 +27,29 @@ export const props = makePropsConfigurable(
2827// @vue /component
2928export const BBadge = /*#__PURE__*/ Vue . extend ( {
3029 name : NAME_BADGE ,
31- mixins : [ normalizeSlotMixin ] ,
30+ functional : true ,
3231 props,
33- render ( h ) {
34- const { variant, $props } = this
35- const link = isLink ( $props )
36- const tag = link ? BLink : this . tag
32+ render ( h , { props, data, children } ) {
33+ const { active, disabled } = props
34+ const link = isLink ( props )
35+ const tag = link ? BLink : props . tag
36+ const variant = props . variant || 'secondary'
3737
3838 return h (
3939 tag ,
40- {
40+ mergeData ( data , {
4141 staticClass : 'badge' ,
4242 class : [
43- variant ? `badge-${ variant } ` : 'badge-secondary' ,
43+ `badge-${ variant } ` ,
4444 {
45- 'badge-pill' : this . pill ,
46- active : this . active ,
47- disabled : this . disabled
45+ 'badge-pill' : props . pill ,
46+ active,
47+ disabled
4848 }
4949 ] ,
50- props : link ? pluckProps ( linkProps , $ props) : { }
51- } ,
52- this . normalizeSlot ( )
50+ props : link ? pluckProps ( linkProps , props ) : { }
51+ } ) ,
52+ children
5353 )
5454 }
5555} )
0 commit comments