# CountDown ### Install ``` javascript import Vue from 'vue'; import { CountDown } from 'vant'; Vue.use(CountDown); ``` ## Usage ### Basic Usage ```html ``` ```js export default { data() { return { time: 30 * 60 * 60 * 1000 }; } } ``` ### Custom Format ```html ``` ### Millisecond ```html ``` ### Custom Style ```html ``` ### Manual Control ```html ``` ```js export default { methods: { start() { this.$refs.countDown.start(); }, pause() { this.$refs.countDown.pause(); }, reset() { this.$refs.countDown.reset(); }, finish() { this.$toast('Finished'); } } } ``` ## API ### Props | Attribute | Description | Type | Default | Version | |------|------|------|------|------| | time | Total time | *number* | - | - | | format | Time format,DD-day,HH-hour,mm-minute,ss-second,SSS-millisecond | *string* | `HH:mm:ss` | - | | auto-start | Whether to auto start count down | *boolean* | `true` | - | | millisecond | Whether to enable millisecond render | *boolean* | `false` | - | ### Events | Event | Description | Arguments | |------|------|------| | finish | Triggered when count down finished | - | ### Slots | Name | Description | SlotProps | |------|------|------| | default | Custom Content | timeData | ### timeData Structure | Name | Description | Type | |------|------|------| | days | Remain days | *number* | | hours | Remain hours | *number* | | minutes | Remain minutes | *number* | | seconds | Remain seconds | *number* | | milliseconds | Remain milliseconds | *number* | ### Methods Use ref to get CountDown instance and call instance methods | Name | Attribute | Return value | Description | |------|------|------|------| | start | - | - | Start count down | | pause | - | - | Pause count down | | reset | - | - | Reset count down |