fix(projects): fix global-tab click conflict with contextmenu
This commit is contained in:
parent
ce66bca1a1
commit
3e72c3b45a
@ -8,6 +8,7 @@ import { useAppStore } from '@/store/modules/app';
|
|||||||
import { useThemeStore } from '@/store/modules/theme';
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import { useRouteStore } from '@/store/modules/route';
|
import { useRouteStore } from '@/store/modules/route';
|
||||||
import { useTabStore } from '@/store/modules/tab';
|
import { useTabStore } from '@/store/modules/tab';
|
||||||
|
import { isPC } from '@/utils/agent';
|
||||||
import ContextMenu from './context-menu.vue';
|
import ContextMenu from './context-menu.vue';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@ -24,6 +25,7 @@ const bsWrapper = ref<HTMLElement>();
|
|||||||
const { width: bsWrapperWidth, left: bsWrapperLeft } = useElementBounding(bsWrapper);
|
const { width: bsWrapperWidth, left: bsWrapperLeft } = useElementBounding(bsWrapper);
|
||||||
const bsScroll = ref<InstanceType<typeof BetterScroll>>();
|
const bsScroll = ref<InstanceType<typeof BetterScroll>>();
|
||||||
const tabRef = ref<HTMLElement>();
|
const tabRef = ref<HTMLElement>();
|
||||||
|
const isPCFlag = isPC();
|
||||||
|
|
||||||
const TAB_DATA_ID = 'data-tab-id';
|
const TAB_DATA_ID = 'data-tab-id';
|
||||||
|
|
||||||
@ -166,7 +168,7 @@ init();
|
|||||||
<template>
|
<template>
|
||||||
<DarkModeContainer class="size-full flex-y-center px-16px shadow-tab">
|
<DarkModeContainer class="size-full flex-y-center px-16px shadow-tab">
|
||||||
<div ref="bsWrapper" class="h-full flex-1-hidden">
|
<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
|
<div
|
||||||
ref="tabRef"
|
ref="tabRef"
|
||||||
class="h-full flex pr-18px"
|
class="h-full flex pr-18px"
|
||||||
|
5
src/utils/agent.ts
Normal file
5
src/utils/agent.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export function isPC() {
|
||||||
|
const agents = ['Android', 'iPhone', 'webOS', 'BlackBerry', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
|
||||||
|
|
||||||
|
return !agents.includes(window.navigator.userAgent);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user