Newer
Older
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
37
38
39
40
41
42
43
<template>
<div class="card border-secondary" :class="[borderClass]">
<div class="card-header" :class="[bgClass, textClass]">
<h5 class="card-title">{{ title }}</h5>
</div>
<div class="card-body">
<h5 v-if="heading">{{ heading }}</h5>
<p class="card-text">
<slot />
</p>
</div>
</div>
</template>
<script>
export default {
props: {
title: String,
heading: String,
type: { type: String, default: "primary" },
},
computed: {
textClass: function() {
const vm = this;
if (
["primary", "secondary", "success", "danger", "dark"].some(
(x) => x === vm.type
)
)
return "text-white";
return "text-dark";
},
borderClass: function() {
return "border-" + this.type;
},
bgClass: function() {
return "bg-" + this.type;
},
},
};
</script>
<style></style>