From 49d88b367d22904fe524e0f6335bd87ab6a09b11 Mon Sep 17 00:00:00 2001 From: clovelll <73922126+clovelll@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:38:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E8=88=AAtab?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=85=B6=E4=BB=96=E6=A0=87=E7=AD=BE=E9=A1=B5?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=87=8D=E7=BD=AE=E7=8A=B6=E6=80=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#446)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复导航tab关闭其他标签页无法重置问题 --- src/layout/components/tag/index.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/layout/components/tag/index.vue b/src/layout/components/tag/index.vue index e164ec960..dd95e4ffa 100644 --- a/src/layout/components/tag/index.vue +++ b/src/layout/components/tag/index.vue @@ -65,7 +65,7 @@ const dynamicTagView = () => { moveToView(index); }; -const moveToView = (index: number): void => { +const moveToView = async (index: number): Promise => { const tabNavPadding = 10; if (!instance.refs["dynamic" + index]) return; const tabItemEl = instance.refs["dynamic" + index][0]; @@ -75,8 +75,13 @@ const moveToView = (index: number): void => { const scrollbarDomWidth = scrollbarDom.value ? scrollbarDom.value?.offsetWidth : 0; + + // 获取视图更新后dom + await nextTick(); + // 已有标签页总长度(包含溢出部分) const tabDomWidth = tabDom.value ? tabDom.value?.offsetWidth : 0; + scrollbarDomWidth <= tabDomWidth ? (isShowArrow.value = true) : (isShowArrow.value = false); @@ -188,6 +193,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) { ): void => { if (other) { useMultiTagsStoreHook().handleTags("equal", [routerArrays[0], obj]); + dynamicTagView(); } else { delAliveRouteList = useMultiTagsStoreHook().handleTags("splice", "", { startIndex,