Skip to content

Commit

Permalink
fix(projects): fix global-tab click conflict with contextmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Sep 21, 2024
1 parent ce66bca commit 3e72c3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/layouts/modules/global-tab/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useAppStore } from '@/store/modules/app';
import { useThemeStore } from '@/store/modules/theme';
import { useRouteStore } from '@/store/modules/route';
import { useTabStore } from '@/store/modules/tab';
import { isPC } from '@/utils/agent';
import ContextMenu from './context-menu.vue';
defineOptions({
Expand All @@ -24,6 +25,7 @@ const bsWrapper = ref<HTMLElement>();
const { width: bsWrapperWidth, left: bsWrapperLeft } = useElementBounding(bsWrapper);
const bsScroll = ref<InstanceType<typeof BetterScroll>>();
const tabRef = ref<HTMLElement>();
const isPCFlag = isPC();
const TAB_DATA_ID = 'data-tab-id';
Expand Down Expand Up @@ -166,7 +168,7 @@ init();
<template>
<DarkModeContainer class="size-full flex-y-center px-16px shadow-tab">
<div ref="bsWrapper" class="h-full flex-1-hidden">
<BetterScroll ref="bsScroll" :options="{ scrollX: true, scrollY: false, click: true }" @click="removeFocus">
<BetterScroll ref="bsScroll" :options="{ scrollX: true, scrollY: false, click: !isPCFlag }" @click="removeFocus">
<div
ref="tabRef"
class="h-full flex pr-18px"
Expand Down
5 changes: 5 additions & 0 deletions src/utils/agent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function isPC() {
const agents = ['Android', 'iPhone', 'webOS', 'BlackBerry', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];

return !agents.includes(window.navigator.userAgent);
}

0 comments on commit 3e72c3b

Please sign in to comment.