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
41 lines (38 loc) • 925 B
JavaScript
import Vue, { mergeData } from '../../vue'
import { NAME_EMBED } from '../../constants/components'
import { arrayIncludes } from '../../utils/array'
export const props = {
type: {
type: String,
default: 'iframe',
validator: str =>
arrayIncludes(['iframe', 'embed', 'video', 'object', 'img', 'b-img', 'b-img-lazy'], str)
},
tag: {
type: String,
default: 'div'
},
aspect: {
type: String,
default: '16by9'
}
}
// @vue/component
export const BEmbed = /*#__PURE__*/ Vue.extend({
name: NAME_EMBED,
functional: true,
props,
render(h, { props, data, children }) {
return h(
props.tag,
{
ref: data.ref,
staticClass: 'embed-responsive',
class: {
[`embed-responsive-${props.aspect}`]: props.aspect
}
},
[h(props.type, mergeData(data, { ref: '', staticClass: 'embed-responsive-item' }), children)]
)
}
})