# countDown **Repository Path**: xiaojin1233323/count-down ## Basic Information - **Project Name**: countDown - **Description**: 呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃呃 - **Primary Language**: Unknown - **License**: Zlib - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-06-19 - **Last Updated**: 2022-08-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
倒计时组件
1.引入
使用element标签引入
<element name="CountDown" src="../../component/CountDown/CountDown.hml"></element>
2.基础用法
m-time 属性表示倒计时总时长,单位为秒。
<countdown m-time="{{ num }}"></countdown>
export default {
data: { num:30 }
}
3.属性
| 名称 | 类型 | 默认值 | 必填 | 描述 |
|---|---|---|---|---|
| mTime | Number | 3600000 | 否 | 倒计时总时长,单位为秒 |
| autoPlay | Boolean | true | 否 | 是否自动开始倒计时 |
| format | String | colon | 否 | 表示选用哪种格式:1. colon: "00:30:00" 2. day:"00天00小时30分钟00秒 3. diy:自定义格式 |
| speed | Number | 1000 | 否 | 倒计时速度 |
4.事件
| 名称 | 描述 |
|---|---|
| transmission | 在自定义中 可通过改事件接收时间数据 |
| finishEvent | 倒计时结束后触发 |
5.自定义用法
<countdown @transmission="fomateTime" @finish-event="fomateTime" m-time="{{ num }}" auto-play="{{ true }}" speed="100" format="diy"> <text style="font-size: 15px; text-align: center;" > {{timeDate.hour}} </text> <text style="font-size: 15px; background-color: mediumvioletred; text-align: center;" > {{timeDate.minute}} </text> <text style="font-size: 15px; text-align: center;" > {{timeDate.second}} </text></countdown>
fomateTime(e){ this.timeDate=e.detail; console.log(JSON.stringify(e));}