Skip to content

Commit c0e8795

Browse files
committed
fix(projects): fix global-tab click conflict with contextmenu
1 parent bfa5196 commit c0e8795

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/layouts/modules/global-tab/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useAppStore } from '@/store/modules/app';
88
import { useThemeStore } from '@/store/modules/theme';
99
import { useRouteStore } from '@/store/modules/route';
1010
import { useTabStore } from '@/store/modules/tab';
11+
import { isPC } from '@/utils/agent';
1112
import ContextMenu from './context-menu.vue';
1213
1314
defineOptions({
@@ -24,6 +25,7 @@ const bsWrapper = ref<HTMLElement>();
2425
const { width: bsWrapperWidth, left: bsWrapperLeft } = useElementBounding(bsWrapper);
2526
const bsScroll = ref<InstanceType<typeof BetterScroll>>();
2627
const tabRef = ref<HTMLElement>();
28+
const isPCFlag = isPC();
2729
2830
const TAB_DATA_ID = 'data-tab-id';
2931
@@ -118,7 +120,7 @@ init();
118120
<template>
119121
<DarkModeContainer class="size-full flex-y-center px-16px shadow-tab">
120122
<div ref="bsWrapper" class="h-full flex-1-hidden">
121-
<BetterScroll ref="bsScroll" :options="{ scrollX: true, scrollY: false, click: true }" @click="removeFocus">
123+
<BetterScroll ref="bsScroll" :options="{ scrollX: true, scrollY: false, click: !isPCFlag }" @click="removeFocus">
122124
<div
123125
ref="tabRef"
124126
class="h-full flex pr-18px"

src/utils/agent.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function isPC() {
2+
const agents = ['Android', 'iPhone', 'webOS', 'BlackBerry', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
3+
4+
return !agents.includes(window.navigator.userAgent);
5+
}

0 commit comments

Comments
 (0)