1
- import { Vue } from '../../vue'
1
+ import { Vue , mergeData } from '../../vue'
2
2
import { NAME_BADGE } from '../../constants/components'
3
3
import { PROP_TYPE_BOOLEAN , PROP_TYPE_STRING } from '../../constants/props'
4
4
import { omit , sortKeys } from '../../utils/object'
5
5
import { makeProp , makePropsConfigurable , pluckProps } from '../../utils/props'
6
6
import { isLink } from '../../utils/router'
7
- import { normalizeSlotMixin } from '../../mixins/normalize-slot'
8
7
import { BLink , props as BLinkProps } from '../link/link'
9
8
10
9
// --- Props ---
@@ -28,28 +27,29 @@ export const props = makePropsConfigurable(
28
27
// @vue /component
29
28
export const BBadge = /*#__PURE__*/ Vue . extend ( {
30
29
name : NAME_BADGE ,
31
- mixins : [ normalizeSlotMixin ] ,
30
+ functional : true ,
32
31
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'
37
37
38
38
return h (
39
39
tag ,
40
- {
40
+ mergeData ( data , {
41
41
staticClass : 'badge' ,
42
42
class : [
43
- variant ? `badge-${ variant } ` : 'badge-secondary' ,
43
+ `badge-${ variant } ` ,
44
44
{
45
- 'badge-pill' : this . pill ,
46
- active : this . active ,
47
- disabled : this . disabled
45
+ 'badge-pill' : props . pill ,
46
+ active,
47
+ disabled
48
48
}
49
49
] ,
50
- props : link ? pluckProps ( linkProps , $ props) : { }
51
- } ,
52
- this . normalizeSlot ( )
50
+ props : link ? pluckProps ( linkProps , props ) : { }
51
+ } ) ,
52
+ children
53
53
)
54
54
}
55
55
} )
0 commit comments