fix: 加载优化
This commit is contained in:
@@ -1,27 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
onMounted(() => {
|
||||
// completeLoading();
|
||||
// const event = new Event('vue-ready');
|
||||
// window.dispatchEvent(event);
|
||||
completeLoading();
|
||||
});
|
||||
|
||||
// 完成加载并隐藏动画
|
||||
function completeLoading() {
|
||||
const loader = document.getElementById('loader');
|
||||
const progressBar = document.getElementById('progress-bar');
|
||||
const progressText = document.getElementById('progress-text');
|
||||
// 确保进度是100%
|
||||
progressBar!.style.width = `${100}%`;
|
||||
progressText!.textContent = `${Math.round(100)}%`;
|
||||
// 淡出加载动画
|
||||
setTimeout(() => {
|
||||
//loader!.style.opacity = '100';
|
||||
setTimeout(() => {
|
||||
loader!.style.display = 'none';
|
||||
}, 500);
|
||||
}, 300);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -9,18 +9,26 @@ import store from './stores';
|
||||
import './styles/index.scss';
|
||||
import 'virtual:uno.css';
|
||||
import 'element-plus/dist/index.css';
|
||||
// SVG插件配置
|
||||
import 'virtual:svg-icons-register';
|
||||
|
||||
// 创建 Vue 应用
|
||||
const app = createApp(App);
|
||||
|
||||
// 安装插件
|
||||
app.use(router);
|
||||
app.use(ElMessage);
|
||||
app.use(ElementPlusX);
|
||||
// 注册ElementPlus所有图标
|
||||
|
||||
// 注册图标
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component);
|
||||
}
|
||||
|
||||
app.use(store);
|
||||
|
||||
// 挂载 Vue 应用
|
||||
// mount 完成说明应用初始化完毕,此时手动通知 loading 动画结束
|
||||
app.mount('#app');
|
||||
|
||||
// 通知 index.html 的 loading 动画进度拉满并淡出
|
||||
(window as any).finishLoading?.();
|
||||
|
||||
Reference in New Issue
Block a user