# CountDown
### Install
```js
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
{{ timeData.hours }}
:
{{ timeData.minutes }}
:
{{ timeData.seconds }}
```
### Manual Control
```html
```
```js
import { Toast } from 'vant';
export default {
methods: {
start() {
this.$refs.countDown.start();
},
pause() {
this.$refs.countDown.pause();
},
reset() {
this.$refs.countDown.reset();
},
finish() {
Toast('Finished');
},
},
};
```
## API
### Props
| Attribute | Description | Type | Default |
| --- | --- | --- | --- |
| 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` |
### Available formats
| Format | Description |
| ------ | --------------------- |
| DD | Day |
| HH | Hour |
| mm | Minute |
| ss | Second |
| S | Millisecond, 1-digit |
| SS | Millisecond, 2-digits |
| SSS | Millisecond, 3-digits |
### Events
| Event | Description | Arguments |
| --------------- | ---------------------------------- | -------------------- |
| finish | Triggered when count down finished | - |
| change `v2.4.4` | Triggered when count down changed | _timeData: TimeData_ |
### Slots
| Name | Description | SlotProps |
| ------- | -------------- | -------------------- |
| default | Custom Content | _timeData: 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](https://vuejs.org/v2/api/#ref) to get CountDown instance and call instance methods
| Name | Description | Attribute | Return value |
| ----- | ---------------- | --------- | ------------ |
| start | Start count down | - | - |
| pause | Pause count down | - | - |
| reset | Reset count down | - | - |