fix: clean up TOC on component unmount

This commit is contained in:
HPCesia 2025-04-04 19:21:46 +08:00
parent 6a69383dcf
commit 8679d67a9f

View File

@ -44,6 +44,13 @@ onMounted(() => {
setup();
document.addEventListener('astro:before-swap', cleanup);
});
onUnmounted(() => {
if (tocWrapper.value) tocWrapper.value.innerHTML = '';
hasToc.value = false;
window.removeEventListener('resize', handleResize);
isWideScreen.value = false;
});
</script>
<template>