2424 :min-column-width =" 128"
2525 :popup-props =" {
2626 overlayClassName: 'route-tabs-dropdown',
27- onVisibleChange: (visible, ctx) => handleTabMenuClick(visible, ctx, routeItem.path),
27+ onVisibleChange: (visible: boolean , ctx: PopupVisibleChangeContext ) => handleTabMenuClick(visible, ctx, routeItem.path),
2828 visible: activeTabPath === routeItem.path,
2929 }"
3030 >
7070</template >
7171
7272<script setup lang="ts">
73+ import type { PopupVisibleChangeContext } from ' tdesign-vue-next' ;
7374import { computed , nextTick , ref } from ' vue' ;
7475import { useRoute , useRouter } from ' vue-router' ;
7576
7677import { prefix } from ' @/config/global' ;
7778import { useSettingStore , useTabsRouterStore } from ' @/store' ;
78- import type { TRouterInfo } from ' @/types/interface' ;
79+ import type { TRouterInfo , TTabRemoveOptions } from ' @/types/interface' ;
7980
8081import LBreadcrumb from ' ./Breadcrumb.vue' ;
8182import LContent from ' ./Content.vue' ;
@@ -95,12 +96,12 @@ const handleChangeCurrentTab = (path: string) => {
9596 router .push ({ path , query: route .query });
9697};
9798
98- const handleRemove = ({ value : path , index } ) => {
99+ const handleRemove = (options : TTabRemoveOptions ) => {
99100 const { tabRouters } = tabsRouterStore ;
100- const nextRouter = tabRouters [index + 1 ] || tabRouters [index - 1 ];
101+ const nextRouter = tabRouters [options . index + 1 ] || tabRouters [options . index - 1 ];
101102
102- tabsRouterStore .subtractCurrentTabRouter ({ path , routeIdx: index });
103- if (path === route .path ) router .push ({ path: nextRouter .path , query: nextRouter .query });
103+ tabsRouterStore .subtractCurrentTabRouter ({ path: options . value as string , routeIdx: options . index });
104+ if (( options . value as string ) === route .path ) router .push ({ path: nextRouter .path , query: nextRouter .query });
104105};
105106
106107const handleRefresh = (route : TRouterInfo , routeIdx : number ) => {
@@ -147,7 +148,7 @@ const handleOperationEffect = (type: 'other' | 'ahead' | 'behind', routeIndex: n
147148
148149 activeTabPath .value = null ;
149150};
150- const handleTabMenuClick = (visible : boolean , ctx , path : string ) => {
151+ const handleTabMenuClick = (visible : boolean , ctx : PopupVisibleChangeContext , path : string ) => {
151152 if (ctx .trigger === ' document' ) activeTabPath .value = null ;
152153 if (visible ) activeTabPath .value = path ;
153154};
0 commit comments