bootstrap-vue
Version:
BootstrapVue provides one of the most comprehensive implementations of Bootstrap 4 components and grid system for Vue.js and with extensive and automated WAI-ARIA accessibility markup.
50 lines (43 loc) • 1.13 kB
JavaScript
import { mergeData } from 'vue-functional-data-merge'
import MediaBody from './media-body'
import MediaAside from './media-aside'
export const props = {
tag: {
type: String,
default: 'div'
},
rightAlign: {
type: Boolean,
default: false
},
verticalAlign: {
type: String,
default: 'top'
},
noBody: {
type: Boolean,
default: false
}
}
export default {
functional: true,
props,
render (h, { props, data, slots, children }) {
let childNodes = props.noBody ? children : []
const $slots = slots()
if (!props.noBody) {
if ($slots.aside && !props.rightAlign) {
childNodes.push(
h(MediaAside, { staticClass: 'mr-3', props: { verticalAlign: props.verticalAlign } }, $slots.aside)
)
}
childNodes.push(h(MediaBody, $slots.default))
if ($slots.aside && props.rightAlign) {
childNodes.push(
h(MediaAside, { staticClass: 'ml-3', props: { verticalAlign: props.verticalAlign } }, $slots.aside)
)
}
}
return h(props.tag, mergeData(data, { staticClass: 'media' }), childNodes)
}
}