提交 93c4dd9f 编写于 作者: H HRK

新增 uni-countdown新增两个属性:showHour showMinute

上级 1c577e89
......@@ -41,6 +41,8 @@
|minute |Number |0 |分钟 |
|second |Number |0 |秒 |
|showDay |Boolean|true |是否显示天数 |
|showHour |Boolean|true |是否显示小时 |
|showMinute |Boolean|true |是否显示分钟 |
|showColon |Boolean|true |是否以冒号为分隔符 |
|start |Boolean|true |是否初始化组件后就开始倒计时|
......@@ -72,20 +74,20 @@
::: preview https://hellouniapp.dcloud.net.cn/pages/extUI/countdown/countdown
> Template
```vue
<template>
<template>
<view class="container">
<uni-card is-full>
<text class="uni-h6">倒计时组件主要用于促销商品剩余时间,发送短信验证等待时间等场景</text>
</uni-card>
</uni-card>
<uni-section title="一般用法" type="line" padding>
<uni-countdown :day="1" :hour="1" :minute="12" :second="40" />
</uni-section>
</uni-section>
<uni-section title="不显示天数" subTitle="设置 show-day = false 不显示天" type="line" padding>
<uni-countdown :show-day="false" :hour="12" :minute="12" :second="12" />
</uni-section>
</uni-section>
<uni-section title="文字分隔符" subTitle="设置 show-colon 属性设置分隔符样式" type="line" padding>
<uni-countdown :minute="30" :second="0" :show-colon="false" />
</uni-section>
</uni-section>
<uni-section title="修改颜色" subTitle="设置 color \ background 属性设置组件颜色" type="line" padding>
<uni-countdown :day="1" :hour="2" :minute="30" :second="0" color="#FFFFFF" background-color="#007AFF" />
</uni-section>
......@@ -94,54 +96,54 @@
</uni-section>
<uni-section title="修改颜色 + 字体大小" type="line" padding>
<uni-countdown :font-size="30" :day="1" :hour="2" :minute="30" :second="0" color="#FFFFFF" background-color="#007AFF" />
</uni-section>
</uni-section>
<uni-section title="自由控制开始/暂停" subTitle="设置 start 属性控制是否自动开启" type="line" padding>
<uni-countdown :start="start" :day="1" :hour="1" :minute="12" :second="40" />
</uni-section>
<uni-section title="倒计时回调事件" type="line" padding>
<uni-countdown :show-day="false" :second="timeupSecond" @timeup="timeup" />
</uni-section>
</uni-section>
<uni-section title="动态赋值" type="line" padding>
<uni-countdown :show-day="false" :hour="testHour" :minute="testMinute" :second="testSecond" />
</uni-section>
</view>
</uni-section>
</view>
</template>
```
> Script
```vue
<script>
export default {
components: {},
data() {
return {
testHour: 1,
testMinute: 0,
```vue
<script>
export default {
components: {},
data() {
return {
testHour: 1,
testMinute: 0,
testSecond: 0,
start: false,
timeupSecond: 10
}
},
mounted() {
timeupSecond: 10
}
},
mounted() {
setTimeout(() => {
this.testHour = 1
this.testMinute = 1
this.testHour = 1
this.testMinute = 1
this.testSecond = 0
this.start = true
this.start = true
}, 3000)
setTimeout(() => {
this.start = false
}, 10000)
},
methods: {
timeup() {
uni.showToast({
title: '时间到'
}, 10000)
},
methods: {
timeup() {
uni.showToast({
title: '时间到'
})
this.timeupSecond = 29
}
}
}
</script>
this.timeupSecond = 29
}
}
}
</script>
```
:::
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册