style: update initial loading indicator

This commit is contained in:
eoao
2026-05-06 00:34:53 +08:00
parent e92a44b069
commit 154f536c61
3 changed files with 88 additions and 60 deletions

View File

@@ -54,18 +54,4 @@ export async function init() {
settingStore.domainList = setting.domainList;
document.title = setting.title;
}
removeLoading();
}
function removeLoading() {
if (window.innerWidth < 1025) {
document.documentElement.style.setProperty('--loading-hide-transition', 'none')
}
const doc = document.getElementById('loading-first');
doc.classList.add('loading-hide')
setTimeout(() => {
doc.remove()
},1000)
}

View File

@@ -92,9 +92,11 @@ router.beforeEach((to, from, next) => {
clearTimeout(timer)
}
timer = setTimeout(() => {
NProgress.start()
}, first ? 200 : 100)
if (!first) {
timer = setTimeout(() => {
NProgress.start()
}, 100)
}
const token = localStorage.getItem('token')
@@ -149,7 +151,11 @@ function loadBackground(next) {
router.afterEach((to) => {
clearTimeout(timer)
NProgress.done();
if (first) {
removeLoading()
} else {
NProgress.done();
}
const uiStore = useUiStore()
if (to.meta.menu) {
@@ -167,4 +173,22 @@ router.afterEach((to) => {
first = false
})
function removeLoading() {
if (window.innerWidth < 1025) {
document.documentElement.style.setProperty('--loading-hide-transition', 'none')
}
const doc = document.getElementById('loading-first');
if (!doc) {
return;
}
doc.classList.add('loading-complete')
setTimeout(() => {
doc.classList.add('loading-hide')
setTimeout(() => {
doc.remove()
}, 1000)
}, 200)
}
export default router