From 5a94e7a00f8762636c770510dc677e7834be9a55 Mon Sep 17 00:00:00 2001 From: zfj <844788189@qq.com> Date: Mon, 5 Sep 2022 18:13:32 +0800 Subject: [PATCH] fix issues #65 --- src/layout/components/TagsView/TagsView.vue | 27 ++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/layout/components/TagsView/TagsView.vue b/src/layout/components/TagsView/TagsView.vue index 1146a5f..010291b 100644 --- a/src/layout/components/TagsView/TagsView.vue +++ b/src/layout/components/TagsView/TagsView.vue @@ -57,8 +57,8 @@ watch( () => $route.path, () => { addTags() + moveToCurrentTag() // tag remove has issue - // moveToCurrentTag() } ) watch( @@ -71,18 +71,6 @@ watch( } } ) - -watch( - () => state.visible, - (value) => { - if (value) { - document.body.addEventListener('click', closeMenu) - } else { - document.body.removeEventListener('click', closeMenu) - } - } -) - onMounted(() => { initTags() addTags() @@ -94,7 +82,18 @@ const isActive = (route) => { const isAffix = (tag) => { return tag.meta && tag.meta.affix } - +const refTag = ref(null) +const moveToCurrentTag= ()=> { + for (const tag of refTag.value) { + if (tag.to.path === $route.path) { + // when query is different then update + if (tag.to.fullPath !== $route.fullPath) { + tagsViewStore.updateVisitedView($route) + } + break + } + } + } const filterAffixTags = (routes, basePath = '/') => { let tags = [] routes.forEach((route) => {