bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
47 lines (41 loc) • 1.18 kB
JavaScript
import { extend, mergeData } from '../../vue'
import { NAME_SKELETON } from '../../constants/components'
import { PROP_TYPE_STRING } from '../../constants/props'
import { makeProp, makePropsConfigurable } from '../../utils/props'
// --- Props ---
export const props = makePropsConfigurable(
{
animation: makeProp(PROP_TYPE_STRING, 'wave'),
height: makeProp(PROP_TYPE_STRING),
size: makeProp(PROP_TYPE_STRING),
type: makeProp(PROP_TYPE_STRING, 'text'),
variant: makeProp(PROP_TYPE_STRING),
width: makeProp(PROP_TYPE_STRING)
},
NAME_SKELETON
)
// --- Main component ---
// @vue/component
export const BSkeleton = /*#__PURE__*/ extend({
name: NAME_SKELETON,
functional: true,
props,
render(h, { data, props }) {
const { size, animation, variant } = props
return h(
'div',
mergeData(data, {
staticClass: 'b-skeleton',
style: {
width: size || props.width,
height: size || props.height
},
class: {
[`b-skeleton-${props.type}`]: true,
[`b-skeleton-animate-${animation}`]: animation,
[`bg-${variant}`]: variant
}
})
)
}
})