Skip to content

Commit

Permalink
chore(@vben-core/tabs-ui): cancel drag and drop function on mobile de…
Browse files Browse the repository at this point in the history
…vices (vbenjs#4303)

resolve  vbenjs#4301
  • Loading branch information
wangjue666 authored Sep 3, 2024
1 parent 3f2dcb8 commit 95a4a85
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/@core/ui-kit/tabs-ui/src/use-tabs-drag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import type { TabsProps } from './types';

import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';

import { type Sortable, useSortable } from '@vben-core/composables';
import {
type Sortable,
useIsMobile,
useSortable,
} from '@vben-core/composables';

// 可能会找到拖拽的子元素,这里需要确保拖拽的dom时tab元素
function findParentElement(element: HTMLElement) {
Expand Down Expand Up @@ -90,6 +94,12 @@ export function useTabsDrag(props: TabsProps, emit: EmitType) {
}

async function init() {
const { isMobile } = useIsMobile();

// 移动端下tab不需要拖拽
if (isMobile.value) {
return;
}
await nextTick();
initTabsSortable();
}
Expand Down

0 comments on commit 95a4a85

Please sign in to comment.