feat(CountDown): time can be string type

This commit is contained in:
陈嘉涵 2020-01-29 10:09:18 +08:00
parent ef70384cdb
commit 36ba412f70
3 changed files with 4 additions and 4 deletions

View File

@ -108,7 +108,7 @@ export default {
| Attribute | Description | Type | Default |
|------|------|------|------|
| time | Total time | *number* | - |
| time | Total time | *number \| string* | `0` |
| format | Time format | *string* | `HH:mm:ss` |
| auto-start | Whether to auto start count down | *boolean* | `true` |
| millisecond | Whether to enable millisecond render | *boolean* | `false` |

View File

@ -118,7 +118,7 @@ export default {
| 参数 | 说明 | 类型 | 默认值 |
|------|------|------|------|
| time | 倒计时时长,单位毫秒 | *number* | - |
| time | 倒计时时长,单位毫秒 | *number \| string* | `0` |
| format | 时间格式 | *string* | `HH:mm:ss` |
| auto-start | 是否自动开始倒计时 | *boolean* | `true` |
| millisecond | 是否开启毫秒级渲染 | *boolean* | `false` |

View File

@ -8,7 +8,7 @@ export default createComponent({
props: {
millisecond: Boolean,
time: {
type: Number,
type: [Number, String],
default: 0,
},
format: {
@ -84,7 +84,7 @@ export default createComponent({
// @exposed-api
reset() {
this.pause();
this.remain = this.time;
this.remain = +this.time;
if (this.autoStart) {
this.start();