Browse Source

首页增加loading效果

dev_230517
zhangzhiyi 2 years ago
parent
commit
bc758984bb
  1. 28
      src/view/tabs/home-screen.vue

28
src/view/tabs/home-screen.vue

@ -1,5 +1,16 @@
<template> <template>
<div id="home-screen-wrapper"> <div id="home-screen-wrapper">
<van-overlay
:show="showOverlay"
z-index="100"
style="background-color: #000;"
>
<van-loading
size="80px"
vertical
color="#1989fa"
><span>加载中...</span></van-loading>
</van-overlay>
<div class="bg-video" @click="changeAnimation()"> <div class="bg-video" @click="changeAnimation()">
<!-- 关机动画循环 --> <!-- 关机动画循环 -->
<video <video
@ -117,6 +128,9 @@ import {
import router from "@/router"; import router from "@/router";
import { CountTo } from "vue3-count-to"; import { CountTo } from "vue3-count-to";
/** 是否显示遮罩层 */
const showOverlay = ref(true);
/** 小时 */ /** 小时 */
const hour = ref("--"); const hour = ref("--");
/** 分钟 */ /** 分钟 */
@ -200,6 +214,9 @@ onActivated(() => {
}); });
onMounted(() => { onMounted(() => {
setTimeout(() => {
showOverlay.value = false;
}, 3500);
getTimeTimer.value = setInterval(() => { getTimeTimer.value = setInterval(() => {
const date = new Date(); const date = new Date();
hour.value = hour.value =
@ -491,5 +508,16 @@ const timeTouchEnd = () => {
justify-content: center; justify-content: center;
} }
} }
.van-loading {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
span {
font-size: 30px !important;
}
}
} }
</style> </style>

Loading…
Cancel
Save