💄 先把所有用到 loading 的给转了一下

This commit is contained in:
BTMuli
2023-05-25 22:06:40 +08:00
parent 9e95fb29b0
commit 749f68f982
10 changed files with 117 additions and 133 deletions

View File

@@ -54,14 +54,14 @@ watch(
(v) => { (v) => {
if (v) { if (v) {
showOut.value = true; showOut.value = true;
setTimeout(() => {
showIn.value = true;
}, 0);
} else {
showIn.value = false; showIn.value = false;
} else {
setTimeout(() => {
showIn.value = false;
}, 100);
setTimeout(() => { setTimeout(() => {
showOut.value = false; showOut.value = false;
}, 200); }, 300);
} }
}, },
); );

View File

@@ -22,10 +22,8 @@
</v-btn> </v-btn>
</template> </template>
</v-app-bar> </v-app-bar>
<div v-show="loading"> <TLoading v-model="loading" :title="loadingTitle" />
<TLoading :title="loadingTitle" /> <div class="wrap">
</div>
<div v-show="!loading" class="wrap">
<!-- 左侧菜单 --> <!-- 左侧菜单 -->
<div class="left-wrap"> <div class="left-wrap">
<v-list v-for="series in seriesList" :key="series.id" class="card-left" @click="selectSeries(series.id)"> <v-list v-for="series in seriesList" :key="series.id" class="card-left" @click="selectSeries(series.id)">

View File

@@ -1,8 +1,5 @@
<template> <template>
<div v-if="loading"> <TLoading v-model="loading" :title="loadingTitle" />
<TLoading :title="loadingTitle" />
</div>
<div v-else>
<v-tabs v-model="tab" align-tabs="start" class="anno-tab"> <v-tabs v-model="tab" align-tabs="start" class="anno-tab">
<v-tab value="activity"> <v-tab value="activity">
活动公告 活动公告
@@ -88,7 +85,6 @@
</div> </div>
</v-window-item> </v-window-item>
</v-window> </v-window>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View File

@@ -1,11 +1,11 @@
<template> <template>
<TLoading v-if="loading" :title="loadingTitle" :subtitle="loadingSubtitle" /> <TLoading v-model="loading" :title="loadingTitle" :subtitle="loadingSubtitle" />
<component :is="item" v-for="item in components" v-show="!loading" :key="item" :ref="setItemRef" /> <component :is="item" v-for="item in components" :key="item" :ref="setItemRef" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue
import { ref, markRaw, onMounted, onUnmounted, onUpdated } from "vue"; import { markRaw, onMounted, onUnmounted, onUpdated, ref } from "vue";
import TLoading from "../components/main/t-loading.vue"; import TLoading from "../components/main/t-loading.vue";
import TPool from "../components/main/t-pool.vue"; import TPool from "../components/main/t-pool.vue";
import TPosition from "../components/main/t-position.vue"; import TPosition from "../components/main/t-position.vue";
@@ -45,6 +45,14 @@ function readLoading (): void {
onMounted(async () => { onMounted(async () => {
loadingTitle.value = "正在加载首页"; loadingTitle.value = "正在加载首页";
loading.value = true;
// 获取当前环境
const timeGet = getBuildTime();
appStore.devEnv = timeGet.startsWith("dev");
if (!appStore.devEnv && appStore.devMode) {
appStore.devMode = false;
}
appStore.buildTime = getBuildTime();
const showItems = homeStore.getShowValue(); const showItems = homeStore.getShowValue();
await Promise.allSettled( await Promise.allSettled(
showItems.map((item) => { showItems.map((item) => {
@@ -61,13 +69,6 @@ onMounted(async () => {
}), }),
); );
timer.value = setInterval(readLoading, 100); timer.value = setInterval(readLoading, 100);
// 获取当前环境
const timeGet = getBuildTime();
appStore.devEnv = timeGet.startsWith("dev");
if (!appStore.devEnv && appStore.devMode) {
appStore.devMode = false;
}
appStore.buildTime = getBuildTime();
}); });
function setItemRef (item: any) { function setItemRef (item: any) {

View File

@@ -1,9 +1,7 @@
<template> <template>
<TSwitchTheme /> <TSwitchTheme />
<div v-if="loading"> <TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<TLoading :empty="loadingEmpty" :title="loadingTitle" /> <div class="anno-json">
</div>
<div v-else class="anno-json">
<div class="anno-title"> <div class="anno-title">
活动列表 JSON 活动列表 JSON
</div> </div>

View File

@@ -1,10 +1,8 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<template> <template>
<TSwitchTheme /> <TSwitchTheme />
<div v-if="loading" class="loading"> <TLoading v-model="loading" :title="loadingTitle" :empty="loadingEmpty" />
<TLoading :title="loadingTitle" :empty="loadingEmpty" /> <div class="anno-body">
</div>
<div v-else class="anno-body">
<div class="anno-title"> <div class="anno-title">
{{ annoData.title }} {{ annoData.title }}
</div> </div>
@@ -47,6 +45,7 @@ onMounted(async () => {
} }
// 获取数据 // 获取数据
loadingTitle.value = "正在获取数据..."; loadingTitle.value = "正在获取数据...";
loading.value = true;
try { try {
annoData.value = await TGRequest.Anno.getContent(annoId); annoData.value = await TGRequest.Anno.getContent(annoId);
loadingTitle.value = "正在渲染数据..."; loadingTitle.value = "正在渲染数据...";
@@ -58,7 +57,7 @@ onMounted(async () => {
} }
setTimeout(() => { setTimeout(() => {
loading.value = false; loading.value = false;
}, 200); }, 1200);
}); });
</script> </script>
<style lang="css" src="../assets/css/anno-parser.css" scoped /> <style lang="css" src="../assets/css/anno-parser.css" scoped />

View File

@@ -1,8 +1,6 @@
<template> <template>
<TSwitchTheme /> <TSwitchTheme />
<div v-if="loading"> <TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<TLoading :empty="loadingEmpty" :title="loadingTitle" />
</div>
<div v-else> <div v-else>
<div class="lottery-div"> <div class="lottery-div">
<div class="lottery-title"> <div class="lottery-title">

View File

@@ -1,8 +1,6 @@
<template> <template>
<div v-show="loading"> <div>
<TLoading :title="loadingTitle" /> <TLoading v-model="loading" :title="loadingTitle" />
</div>
<div v-show="!loading">
<v-tabs v-model="tab" align-tabs="start" class="news-tab"> <v-tabs v-model="tab" align-tabs="start" class="news-tab">
<v-tab value="notice"> <v-tab value="notice">
公告 公告

View File

@@ -1,9 +1,7 @@
<template> <template>
<TSwitchTheme /> <TSwitchTheme />
<div v-if="loading"> <TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<TLoading :empty="loadingEmpty" :title="loadingTitle" /> <div class="post-json">
</div>
<div v-else class="post-json">
<div class="post-title"> <div class="post-title">
帖子返回内容 JSON 帖子返回内容 JSON
</div> </div>

View File

@@ -1,10 +1,8 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<template> <template>
<TSwitchTheme /> <TSwitchTheme />
<div v-if="loading"> <TLoading v-model="loading" :empty="loadingEmpty" :title="loadingTitle" />
<TLoading :empty="loadingEmpty" :title="loadingTitle" /> <div class="mys-post-body" v-html="postHtml" />
</div>
<div v-else class="mys-post-body" v-html="postHtml" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// vue // vue