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
69 lines (63 loc) • 1.77 kB
JavaScript
import Vue, { mergeData } from '../../vue';
import { NAME_MEDIA } from '../../constants/components';
import { SLOT_NAME_DEFAULT } from '../../constants/slot-names';
import { normalizeSlot } from '../../utils/normalize-slot';
import { BMediaBody } from './media-body';
import { BMediaAside } from './media-aside';
export var props = {
tag: {
type: String,
default: 'div'
},
rightAlign: {
type: Boolean,
default: false
},
verticalAlign: {
type: String,
default: 'top'
},
noBody: {
type: Boolean,
default: false
}
}; // @vue/component
export var BMedia = /*#__PURE__*/Vue.extend({
name: NAME_MEDIA,
functional: true,
props: props,
render: function render(h, _ref) {
var props = _ref.props,
data = _ref.data,
slots = _ref.slots,
scopedSlots = _ref.scopedSlots,
children = _ref.children;
var childNodes = props.noBody ? children : [];
if (!props.noBody) {
var $slots = slots();
var $scopedSlots = scopedSlots || {};
var $aside = normalizeSlot('aside', {}, $scopedSlots, $slots);
var $default = normalizeSlot(SLOT_NAME_DEFAULT, {}, $scopedSlots, $slots);
if ($aside && !props.rightAlign) {
childNodes.push(h(BMediaAside, {
staticClass: 'mr-3',
props: {
verticalAlign: props.verticalAlign
}
}, $aside));
}
childNodes.push(h(BMediaBody, $default));
if ($aside && props.rightAlign) {
childNodes.push(h(BMediaAside, {
staticClass: 'ml-3',
props: {
verticalAlign: props.verticalAlign
}
}, $aside));
}
}
return h(props.tag, mergeData(data, {
staticClass: 'media'
}), childNodes);
}
});