fix: 应该在组件销毁前移除路由变化事件监听器
This commit is contained in:
parent
086e9a8c60
commit
5113d60565
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<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 RouteLocationNormalizedLoaded, type RouteRecordRaw, RouterLink, useRoute, useRouter } from "vue-router"
|
||||||
import { type TagView, useTagsViewStore } from "@/store/modules/tags-view"
|
import { type TagView, useTagsViewStore } from "@/store/modules/tags-view"
|
||||||
import { usePermissionStore } from "@/store/modules/permission"
|
import { usePermissionStore } from "@/store/modules/permission"
|
||||||
@ -161,7 +161,7 @@ onMounted(() => {
|
|||||||
addTags(route)
|
addTags(route)
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onBeforeUnmount(() => {
|
||||||
removeRouteListener()
|
removeRouteListener()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user