style: update initial loading indicator
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user