fix
This commit is contained in:
22
nuxt4-app/app/plugins/loading.client.ts
Normal file
22
nuxt4-app/app/plugins/loading.client.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export default defineNuxtPlugin(() => {
|
||||
// This plugin ensures the loading screen is properly hidden when the app is ready
|
||||
|
||||
if (process.client) {
|
||||
// Listen for when the app is fully hydrated
|
||||
const checkReady = () => {
|
||||
// Wait for next tick to ensure DOM is painted
|
||||
requestAnimationFrame(() => {
|
||||
setTimeout(() => {
|
||||
document.documentElement.classList.add('nuxt-ready')
|
||||
}, 50)
|
||||
})
|
||||
}
|
||||
|
||||
// Multiple triggers to ensure loading screen is hidden
|
||||
if (document.readyState === 'complete') {
|
||||
checkReady()
|
||||
} else {
|
||||
window.addEventListener('load', checkReady)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user