You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.5 KiB
71 lines
2.5 KiB
<template>
|
|
<view class="container">
|
|
<uni-card is-full>
|
|
<text class="uni-h6">倒计时组件主要用于促销商品剩余时间,发送短信验证等待时间等场景</text>
|
|
</uni-card>
|
|
<uni-section title="一般用法" type="line" padding>
|
|
<uni-countdown :day="1" :hour="1" :minute="12" :second="40" />
|
|
</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 title="文字分隔符" subTitle="设置 show-colon 属性设置分隔符样式" type="line" padding>
|
|
<uni-countdown :minute="30" :second="0" :show-colon="false" />
|
|
</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>
|
|
<uni-section title="修改字体大小" subTitle="设置 font-size 属性设置组件大小" type="line" padding>
|
|
<uni-countdown :font-size="30" :day="1" :hour="2" :minute="30" :second="0" />
|
|
</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 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 title="动态赋值" type="line" padding>
|
|
<uni-countdown :show-day="false" :hour="testHour" :minute="testMinute" :second="testSecond" />
|
|
</uni-section>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
testHour: 1,
|
|
testMinute: 0,
|
|
testSecond: 0,
|
|
start: false,
|
|
timeupSecond: 10
|
|
}
|
|
},
|
|
mounted() {
|
|
setTimeout(() => {
|
|
this.testHour = 1
|
|
this.testMinute = 1
|
|
this.testSecond = 0
|
|
this.start = true
|
|
}, 3000)
|
|
setTimeout(() => {
|
|
this.start = false
|
|
}, 10000)
|
|
},
|
|
methods: {
|
|
timeup() {
|
|
uni.showToast({
|
|
title: '时间到'
|
|
})
|
|
this.timeupSecond = 29
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
</style>
|
|
|