Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-21 11:29:20 +08:00

fix: 应该在组件销毁前移除路由变化事件监听器

This commit is contained in:
pany 2023-08-25 15:58:38 +08:00
parent 086e9a8c60
commit 5113d60565

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { getCurrentInstance, onMounted, onUnmounted, ref, watch } from "vue"
import { getCurrentInstance, onBeforeUnmount, onMounted, ref, watch } from "vue"
import { type RouteLocationNormalizedLoaded, type RouteRecordRaw, RouterLink, useRoute, useRouter } from "vue-router"
import { type TagView, useTagsViewStore } from "@/store/modules/tags-view"
import { usePermissionStore } from "@/store/modules/permission"
@ -161,7 +161,7 @@ onMounted(() => {
addTags(route)
})
onUnmounted(() => {
onBeforeUnmount(() => {
removeRouteListener()
})
</script>