8000 fix(b-badge): attribute inheritance (closes #6209) by jacobmllr95 · Pull Request #6217 · bootstrap-vue/bootstrap-vue · GitHub
[go: up one dir, main page]

Skip to content

fix(b-badge): attribute inheritance (closes #6209) #6217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/components/badge/badge.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Vue } from '../../vue'
import { Vue, mergeData } from '../../vue'
import { NAME_BADGE } from '../../constants/components'
import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../../constants/props'
import { omit, sortKeys } from '../../utils/object'
import { makeProp, makePropsConfigurable, pluckProps } from '../../utils/props'
import { isLink } from '../../utils/router'
import { normalizeSlotMixin } from '../../mixins/normalize-slot'
import { BLink, props as BLinkProps } from '../link/link'

// --- Props ---
Expand All @@ -28,28 +27,29 @@ export const props = makePropsConfigurable(
// @vue/component
export const BBadge = /*#__PURE__*/ Vue.extend({
name: NAME_BADGE,
mixins: [normalizeSlotMixin],
functional: true,
props,
render(h) {
const { variant, $props } = this
const link = isLink($props)
const tag = link ? BLink : this.tag
render(h, { props, data, children }) {
const { active, disabled } = props
const link = isLink(props)
const tag = link ? BLink : props.tag
const variant = props.variant || 'secondary'

return h(
tag,
{
mergeData(data, {
staticClass: 'badge',
class: [
variant ? `badge-${variant}` : 'badge-secondary',
`badge-${variant}`,
{
'badge-pill': this.pill,
active: this.active,
disabled: this.disabled
'badge-pill': props.pill,
active,
disabled
}
],
props: link ? pluckProps(linkProps, $props) : {}
},
this.normalizeSlot()
props: link ? pluckProps(linkProps, props) : {}
}),
children
)
}
})
0