뒤로가기 복귀 로딩 상태 정리

This commit is contained in:
2026-07-24 16:26:26 +09:00
parent e065798b78
commit d67f735978
6 changed files with 25 additions and 4 deletions

View File

@@ -42,6 +42,19 @@ export default defineNuxtPlugin((nuxtApp) => {
document.documentElement.classList.remove(SITE_ROUTE_VEIL_CLASS)
}
/**
* BFCache에 들어가거나 BFCache에서 돌아온 문서의 전환 베일을 정리한다.
* @param {PageTransitionEvent} event - 페이지 전환 이벤트
* @returns {void}
*/
const handlePageCacheTransition = (event) => {
if (!event.persisted) {
return
}
hideRouteVeil()
}
/**
* 내부 링크 클릭이 라우터보다 먼저 베일을 덮도록 한다.
* @param {MouseEvent} event - 클릭 이벤트
@@ -131,6 +144,8 @@ export default defineNuxtPlugin((nuxtApp) => {
}
document.addEventListener('click', handleInternalLinkCapture, true)
window.addEventListener('pagehide', handlePageCacheTransition)
window.addEventListener('pageshow', handlePageCacheTransition)
router.beforeEach((to, from) => {
if (!shouldStartSiteRouteVeilNavigation(to, from)) {