/
card-header.js
36 lines (34 loc) · 1.12 KB
/
card-header.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { mergeData, prefixPropName, copyProps } from "../utils";
import { assign } from "../utils/object";
import { cardMixin } from "../mixins";
export const props = assign({}, copyProps(cardMixin.props, prefixPropName.bind(null, "header")), {
header: {
type: String,
default: null
},
headerClass: {
type: [String, Object, Array],
default: null
}
});
export default {
functional: true,
props,
render(h, { props, data, slots }) {
return h(
props.headerTag,
mergeData(data, {
staticClass: "card-header",
class: [
props.headerClass,
{
[`bg-${props.headerBgVariant}`]: Boolean(props.headerBgVariant),
[`border-${props.headerBorderVariant}`]: Boolean(props.headerBorderVariant),
[`text-${props.headerTextVariant}`]: Boolean(props.headerTextVariant)
}
]
}),
slots().default || [h("div", { domProps: { innerHTML: props.header } })]
);
}
};