UNPKG

bootstrap-vue

Version:

BootstrapVue, with more than 85 custom components, over 45 plugins, several custom directives, and over 300 icons, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated W

54 lines (47 loc) 1.26 kB
import Vue from '../../utils/vue' import { mergeData } from 'vue-functional-data-merge' import { getComponentConfig } from '../../utils/config' import pluckProps from '../../utils/pluck-props' import { BLink, propsFactory as linkPropsFactory } from '../link/link' const NAME = 'BBadge' const linkProps = linkPropsFactory() delete linkProps.href.default delete linkProps.to.default export const props = { ...linkProps, tag: { type: String, default: 'span' }, variant: { type: String, default: () => getComponentConfig(NAME, 'variant') }, pill: { type: Boolean, default: false } } // @vue/component export const BBadge = /*#__PURE__*/ Vue.extend({ name: NAME, functional: true, props, render(h, { props, data, children }) { const isBLink = props.href || props.to const tag = isBLink ? BLink : props.tag const componentData = { staticClass: 'badge', class: [ props.variant ? `badge-${props.variant}` : 'badge-secondary', { 'badge-pill': props.pill, active: props.active, disabled: props.disabled } ], props: isBLink ? pluckProps(linkProps, props) : {} } return h(tag, mergeData(data, componentData), children) } })