docs: fix statistic demo

pull/1040/head
wangxueliang 2019-05-28 11:10:38 +08:00
parent 15c645fea1
commit f5471713f2
5 changed files with 99 additions and 64 deletions

View File

@ -10,23 +10,41 @@ Display statistic data in Card.
```html ```html
<template> <template>
<div> <div style="background: #ECECEC; padding: 30px">
<a-card style="padding: 30px"> <a-row :gutter="16">
<a-statistic <a-col :span="12">
title="Feedback" <a-card>
:value="1128" <a-statistic
style="margin-right: 50px" title="Feedback"
> :value="11.28"
<a-icon slot="prefix" type="like" /> :precision="2"
</a-statistic> suffix="%"
<a-statistic :valueStyle="{color: '#3f8600'}"
title="Unmerged" style="margin-right: 50px"
:value="1234567890" >
valueClass="demo-class" <template v-slot:prefix>
> <a-icon type="arrow-up" />
<span slot="suffix"> / 100</span> </template>
</a-statistic> </a-statistic>
</a-card> </a-card>
</a-col>
<a-col :span="12">
<a-card>
<a-statistic
title="Idle"
:value="9.3"
:precision="2"
suffix="%"
valueClass="demo-class"
:valueStyle="{ color: '#cf1322' }"
>
<template v-slot:prefix>
<a-icon type="arrow-down" />
</template>
</a-statistic>
</a-card>
</a-col>
</a-row>
</div> </div>
</template> </template>
``` ```

View File

@ -10,19 +10,31 @@ Countdown component.
```html ```html
<template> <template>
<div> <a-row :gutter="16">
<a-statistic-countdown <a-col :span="12">
title="Countdown" <a-statistic-countdown
:value="deadline" title="Countdown"
@finish="onFinish" :value="deadline"
style="margin-right: 50px" @finish="onFinish"
/> style="margin-right: 50px"
<a-statistic-countdown />
title="Million Seconds" </a-col>
:value="deadline" <a-col :span="12">
format="HH:mm:ss:SSS" <a-statistic-countdown
/> title="Million Seconds"
</div> :value="deadline"
format="HH:mm:ss:SSS"
style="margin-right: 50px"
/>
</a-col>
<a-col :span="24" style="margin-top: 32px;">
<a-statistic-countdown
title="Day Level"
:value="deadline"
format="D 天 H 时 m 分 s 秒"
/>
</a-col>
</a-row>
</template> </template>
<script> <script>
export default { export default {
@ -38,4 +50,4 @@ export default {
}, },
} }
</script> </script>
``` ```

View File

@ -10,24 +10,29 @@ Add unit through `prefix` and `suffix`.
```html ```html
<template> <template>
<div> <a-row :gutter="16">
<a-statistic <a-col :span="12">
title="Feedback" <a-statistic
:value="11.28" title="Feedback"
:precision="2" :value="1128"
suffix="%" style="margin-right: 50px"
:valueStyle="{color: '#3f8600'}" >
style="margin-right: 50px" <template v-slot:suffix>
> <a-icon type="like" />
<a-icon slot="prefix" type="arrow-up" /> </template>
</a-statistic> </a-statistic>
<a-statistic </a-col>
title="Unmerged" <a-col :span="12">
:value="78" <a-statistic
valueClass="demo-class" title="Unmerged"
> :value="93"
<span slot="suffix"> / 100</span> valueClass="demo-class"
</a-statistic> >
</div> <template v-slot:suffix>
<span> / 100</span>
</template>
</a-statistic>
</a-col>
</a-row>
</template> </template>
``` ```

View File

@ -5,12 +5,12 @@
| Property | Description | Type | Default | | Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- | | -------- | ----------- | ---- | ------- |
| decimalSeparator | decimal separator | string | . | | decimalSeparator | decimal separator | string | . |
| formatter | customize value display logic | (h) => VNode | - | | formatter | customize value display logic | v-slot \|(h) => VNode | - |
| groupSeparator | group separator | string | , | | groupSeparator | group separator | string | , |
| precision | precision of input value | number | - | | precision | precision of input value | number | - |
| prefix | prefix node of value | string \| VNode | - | | prefix | prefix node of value | string \| v-slot | - |
| suffix | suffix node of value | string \| VNode | - | | suffix | suffix node of value | string \| v-slot | - |
| title | Display title | string \| VNode | - | | title | Display title | string \| v-slot | - |
| value | Display value | string \| number | - | | value | Display value | string \| number | - |
@ -19,9 +19,9 @@
| Property | Description | Type | Default | | Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- | | -------- | ----------- | ---- | ------- |
| format | Format as [moment](http://momentjs.com/) | string | 'HH:mm:ss' | | format | Format as [moment](http://momentjs.com/) | string | 'HH:mm:ss' |
| prefix | prefix node of value | string \| VNode | - | | prefix | prefix node of value | string \| v-slot | - |
| suffix | suffix node of value | string \| VNode | - | | suffix | suffix node of value | string \| v-slot | - |
| title | Display title | string \| VNode | - | | title | Display title | string \| v-slot | - |
| value | Set target countdown time | number \| moment | - | | value | Set target countdown time | number \| moment | - |
#### Statistic.Countdown Events #### Statistic.Countdown Events

View File

@ -5,12 +5,12 @@
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| -------- | ----------- | ---- | ------- | | -------- | ----------- | ---- | ------- |
| decimalSeparator | 设置小数点 | string | . | | decimalSeparator | 设置小数点 | string | . |
| formatter | 自定义数值展示 | (h) => VNode | - | | formatter | 自定义数值展示 | v-slot \| (h) => VNode | - |
| groupSeparator | 设置千分位标识符 | string | , | | groupSeparator | 设置千分位标识符 | string | , |
| precision | 数值精度 | number | - | | precision | 数值精度 | number | - |
| prefix | 设置数值的前缀 | string \| VNode | - | | prefix | 设置数值的前缀 | string \| v-slot | - |
| suffix | 设置数值的后缀 | string \| VNode | - | | suffix | 设置数值的后缀 | string \| v-slot | - |
| title | 数值的标题 | string \| VNode | - | | title | 数值的标题 | string \| v-slot | - |
| value | 数值内容 | string \| number | - | | value | 数值内容 | string \| number | - |
### Statistic.Countdown ### Statistic.Countdown
@ -18,9 +18,9 @@
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| -------- | ----------- | ---- | ------- | | -------- | ----------- | ---- | ------- |
| format | 格式化倒计时展示,参考 [moment](http://momentjs.com/) | string | 'HH:mm:ss' | | format | 格式化倒计时展示,参考 [moment](http://momentjs.com/) | string | 'HH:mm:ss' |
| prefix | 设置数值的前缀 | string \| VNode | - | | prefix | 设置数值的前缀 | string \| v-slot | - |
| suffix | 设置数值的后缀 | string \| VNode | - | | suffix | 设置数值的后缀 | string \| v-slot | - |
| title | 数值的标题 | string \| VNode | - | | title | 数值的标题 | string \| v-slot | - |
| value | 数值内容 | number \| moment | - | | value | 数值内容 | number \| moment | - |
#### Statistic.Countdown事件 #### Statistic.Countdown事件