File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/layouts/modules/global-tab Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ const isPCFlag = isPC();
2727
2828const TAB_DATA_ID = ' data-tab-id' ;
2929const MIDDLE_MOUSE_BUTTON = 1 ;
30+ const RIGHT_MOUSE_BUTTON = 2 ;
3031
3132type TabNamedNodeMap = NamedNodeMap & {
3233 [TAB_DATA_ID ]: Attr ;
@@ -99,6 +100,12 @@ function handleMousedown(e: MouseEvent, tab: App.Global.Tab) {
99100 handleCloseTab (tab );
100101}
101102
103+ function switchTab(e : MouseEvent , tab : App .Global .Tab ) {
104+ if ([MIDDLE_MOUSE_BUTTON , RIGHT_MOUSE_BUTTON ].includes (e .button )) return ;
105+
106+ tabStore .switchRouteByTab (tab );
107+ }
108+
102109async function refresh() {
103110 appStore .reloadPage (500 );
104111}
@@ -197,7 +204,7 @@ init();
197204 :active =" tab.id === tabStore.activeTabId"
198205 :active-color =" themeStore.themeColor"
199206 :closable =" !tabStore.isTabRetain(tab.id)"
200- @pointerdown =" tabStore.switchRouteByTab( tab)"
207+ @pointerdown =" switchTab($event, tab)"
201208 @mousedown =" handleMousedown($event, tab)"
202209 @close =" handleCloseTab(tab)"
203210 @contextmenu =" handleContextMenu($event, tab.id)"
You can’t perform that action at this time.
0 commit comments