Blame view

pages/extUI/countdown/countdown.nvue 2.46 KB
4b045f7c   刘淇   江阴初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  <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>