Skip to content

Commit 2d31f31

Browse files
authored
fix(b-badge): attribute inheritance (#6217)
1 parent 815fb5e commit 2d31f31

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/components/badge/badge.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { Vue } from '../../vue'
1+
import { Vue, mergeData } from '../../vue'
22
import { NAME_BADGE } from '../../constants/components'
33
import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../../constants/props'
44
import { omit, sortKeys } from '../../utils/object'
55
import { makeProp, makePropsConfigurable, pluckProps } from '../../utils/props'
66
import { isLink } from '../../utils/router'
7-
import { normalizeSlotMixin } from '../../mixins/normalize-slot'
87
import { BLink, props as BLinkProps } from '../link/link'
98

109
// --- Props ---
@@ -28,28 +27,29 @@ export const props = makePropsConfigurable(
2827
// @vue/component
2928
export 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

Comments
 (0)