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-col :span="12">
<a-card>
<a-statistic <a-statistic
title="Feedback" title="Feedback"
:value="1128" :value="11.28"
:precision="2"
suffix="%"
:valueStyle="{color: '#3f8600'}"
style="margin-right: 50px" style="margin-right: 50px"
> >
<a-icon slot="prefix" type="like" /> <template v-slot:prefix>
</a-statistic> <a-icon type="arrow-up" />
<a-statistic </template>
title="Unmerged"
:value="1234567890"
valueClass="demo-class"
>
<span slot="suffix"> / 100</span>
</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-col :span="12">
<a-statistic-countdown <a-statistic-countdown
title="Countdown" title="Countdown"
:value="deadline" :value="deadline"
@finish="onFinish" @finish="onFinish"
style="margin-right: 50px" style="margin-right: 50px"
/> />
</a-col>
<a-col :span="12">
<a-statistic-countdown <a-statistic-countdown
title="Million Seconds" title="Million Seconds"
:value="deadline" :value="deadline"
format="HH:mm:ss:SSS" format="HH:mm:ss:SSS"
style="margin-right: 50px"
/> />
</div> </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 {

View File

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