fix: 修复导航tab关闭其他标签页无法重置状态问题 (#446)

* fix: 修复导航tab关闭其他标签页无法重置问题
This commit is contained in:
clovelll 2023-02-16 12:38:20 +08:00 committed by GitHub
parent 3ee8c51f90
commit 49d88b367d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,7 +65,7 @@ const dynamicTagView = () => {
moveToView(index);
};
const moveToView = (index: number): void => {
const moveToView = async (index: number): Promise<void> => {
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,