PageLoader: hide after full progress
This commit is contained in:
@@ -32,11 +32,17 @@ const createStyle = (size) => {
|
|||||||
width: `${size}%`,
|
width: `${size}%`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let interval = null
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('beforeunload', () => {
|
window.addEventListener('beforeunload', () => {
|
||||||
setInterval(() => {
|
interval = setInterval(() => {
|
||||||
width.value = Math.min(width.value + 0.2, 100)
|
width.value = Math.min(width.value + 0.2, 100)
|
||||||
|
|
||||||
|
if (width.value === 100) {
|
||||||
|
clearInterval(interval)
|
||||||
|
window.setTimeout(() => (width.value = 0), 2000)
|
||||||
|
}
|
||||||
}, 25)
|
}, 25)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user