@@ -4,6 +4,11 @@ import { Color } from '../props'
4
4
import { CCard , CCardBody , CCardHeader } from './../card/'
5
5
import { CCol } from './../grid/'
6
6
7
+ type Value = {
8
+ title ?: string
9
+ value ?: number | string
10
+ }
11
+
7
12
const CWidgetStatsD = defineComponent ( {
8
13
name : 'CWidgetStatsD' ,
9
14
props : {
@@ -17,12 +22,12 @@ const CWidgetStatsD = defineComponent({
17
22
* Values and titles for your component.
18
23
*/
19
24
values : {
20
- type : Array as PropType < number [ ] | string [ ] > ,
25
+ type : Array as PropType < Value [ ] > ,
21
26
default : ( ) => [ ] ,
22
27
require : false ,
23
28
} ,
24
29
} ,
25
- /**
30
+ /**
26
31
* Location for icon component, ex. `<CDropdown>`.
27
32
*
28
33
* @slot icon
@@ -59,18 +64,18 @@ const CWidgetStatsD = defineComponent({
59
64
{
60
65
default : ( ) =>
61
66
props . values &&
62
- props . values . map ( ( value : number | string , index : number ) => [
67
+ props . values . map ( ( value : Value , index : number ) => [
63
68
index % 2 !== 0 && h ( 'div' , { class : 'vr' } ) ,
64
69
h (
65
70
CCol ,
66
71
{ } ,
67
72
{
68
73
default : ( ) => [
69
- h ( CCol , { class : 'fs-5 fw-semibold' } , ( ) => value [ 0 ] ) ,
74
+ h ( CCol , { class : 'fs-5 fw-semibold' } , ( ) => value . value ) ,
70
75
h (
71
76
CCol ,
72
77
{ class : 'text-uppercase text-medium-emphasis small' } ,
73
- ( ) => value [ 1 ] ,
78
+ ( ) => value . title ,
74
79
) ,
75
80
] ,
76
81
} ,
0 commit comments