Skip to content

Commit d6b23f3

Browse files
committed
refactor: chart-card api
1 parent dbdebca commit d6b23f3

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/components/chart/ChartCard.vue

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
<a-card :loading="loading" :body-style="{ padding: '20px 24px 8px' }" :bordered="false">
33
<div class="chart-card-header">
44
<div class="meta">
5-
<span class="chart-card-title">{{ title }}</span>
5+
<span class="chart-card-title">
6+
<slot name="title">
7+
{{ title }}
8+
</slot>
9+
</span>
610
<span class="chart-card-action">
711
<slot name="action"></slot>
812
</span>
913
</div>
10-
<div class="total"><span>{{ total }}</span></div>
14+
<div class="total">
15+
<slot name="total">
16+
<span>{{ typeof total === 'function' && total() || total }}</span>
17+
</slot>
18+
</div>
1119
</div>
1220
<div class="chart-card-content">
1321
<div class="content-fix">
@@ -31,8 +39,9 @@ export default {
3139
default: ''
3240
},
3341
total: {
34-
type: String,
35-
default: ''
42+
type: [Function, Number, String],
43+
required: false,
44+
default: null
3645
},
3746
loading: {
3847
type: Boolean,
@@ -108,4 +117,4 @@ export default {
108117
line-height: 38px;
109118
height: 38px;
110119
}
111-
</style>
120+
</style>

0 commit comments

Comments
 (0)