1. <template>
    2. <view class="content-main welcome">
    3. <view class="count-down" @click="handleClose">
    4. <view class="num">{{ count }}s</view>
    5. <view class="text">跳过</view>
    6. </view>
    7. </view>
    8. </template>
    9. <script lang='ts'>
    10. import { Component, Vue } from "vue-property-decorator";
    11. @Component({})
    12. export default class extends Vue {
    13. timer: any = null;
    14. count: number = 5;
    15. onLoad() {
    16. this.handleCountDown();
    17. }
    18. // 定时器
    19. handleCountDown() {
    20. this.timer = setInterval(() => {
    21. this.count--;
    22. if (this.count < 1) {
    23. this.handleClose();
    24. clearInterval(this.timer);
    25. }
    26. }, 1000);
    27. }
    28. handleClose() {
    29. if (this.timer) {
    30. clearInterval(this.timer);
    31. }
    32. this.Foundation.nav("lottery");
    33. }
    34. }
    35. </script>
    36. <style lang='scss' scoped>
    37. .welcome {
    38. background-image: url("~@/static/img/welcome.jpg");
    39. color: #a9adb0;
    40. text-align: center;
    41. font-size: 28rpx;
    42. .count-down {
    43. position: absolute;
    44. right: 20rpx;
    45. top: 20rpx;
    46. .num {
    47. width: 68rpx;
    48. height: 68rpx;
    49. line-height: 68rpx;
    50. border-radius: 50%;
    51. text-align: center;
    52. color: #ffffff;
    53. background-color: rgba(0, 0, 0, 0.33);
    54. margin-bottom: 6rpx;
    55. }
    56. }
    57. }
    58. </style>