<template>
<view class="content-main welcome">
<view class="count-down" @click="handleClose">
<view class="num">{{ count }}s</view>
<view class="text">跳过</view>
</view>
</view>
</template>
<script lang='ts'>
import { Component, Vue } from "vue-property-decorator";
@Component({})
export default class extends Vue {
timer: any = null;
count: number = 5;
onLoad() {
this.handleCountDown();
}
// 定时器
handleCountDown() {
this.timer = setInterval(() => {
this.count--;
if (this.count < 1) {
this.handleClose();
clearInterval(this.timer);
}
}, 1000);
}
handleClose() {
if (this.timer) {
clearInterval(this.timer);
}
this.Foundation.nav("lottery");
}
}
</script>
<style lang='scss' scoped>
.welcome {
background-image: url("~@/static/img/welcome.jpg");
color: #a9adb0;
text-align: center;
font-size: 28rpx;
.count-down {
position: absolute;
right: 20rpx;
top: 20rpx;
.num {
width: 68rpx;
height: 68rpx;
line-height: 68rpx;
border-radius: 50%;
text-align: center;
color: #ffffff;
background-color: rgba(0, 0, 0, 0.33);
margin-bottom: 6rpx;
}
}
}
</style>