|
|
@ -1,12 +1,15 @@ |
|
|
|
import { nextTick, ref, toRaw } from 'vue' |
|
|
|
import { nextTick, ref, toRaw } from 'vue' |
|
|
|
import type { RouteLocationNormalized } from 'vue-router' |
|
|
|
import type { RouteLocationNormalized } from 'vue-router' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
|
|
|
|
import { useI18n } from '@/hooks/web/useI18n' |
|
|
|
import { useDesign } from '@/hooks/web/useDesign' |
|
|
|
import { useDesign } from '@/hooks/web/useDesign' |
|
|
|
import { useSortable } from '@/hooks/web/useSortable' |
|
|
|
import { useSortable } from '@/hooks/web/useSortable' |
|
|
|
import { useMultipleTabStore } from '@/store/modules/multipleTab' |
|
|
|
import { useMultipleTabStore } from '@/store/modules/multipleTab' |
|
|
|
import { isNullAndUnDef } from '@/utils/is' |
|
|
|
import { isNullAndUnDef } from '@/utils/is' |
|
|
|
import projectSetting from '@/settings/projectSetting' |
|
|
|
import projectSetting from '@/settings/projectSetting' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
|
|
export function initAffixTabs(): string[] { |
|
|
|
export function initAffixTabs(): string[] { |
|
|
|
const affixList = ref<RouteLocationNormalized[]>([]) |
|
|
|
const affixList = ref<RouteLocationNormalized[]>([]) |
|
|
|
|
|
|
|
|
|
|
@ -58,11 +61,11 @@ export function useTabsDrag(affixTextList: string[]) { |
|
|
|
return |
|
|
|
return |
|
|
|
const el = document.querySelectorAll(`.${prefixCls} .ant-tabs-nav-wrap > div`)?.[0] as HTMLElement |
|
|
|
const el = document.querySelectorAll(`.${prefixCls} .ant-tabs-nav-wrap > div`)?.[0] as HTMLElement |
|
|
|
const { initSortable } = useSortable(el, { |
|
|
|
const { initSortable } = useSortable(el, { |
|
|
|
filter: (e: ChangeEvent) => { |
|
|
|
filter: (_evt, target: HTMLElement) => { |
|
|
|
const text = e?.target?.innerText |
|
|
|
const text = target.innerText |
|
|
|
if (!text) |
|
|
|
if (!text) |
|
|
|
return false |
|
|
|
return false |
|
|
|
return affixTextList.includes(text) |
|
|
|
return affixTextList.map(res => t(res)).includes(text) |
|
|
|
}, |
|
|
|
}, |
|
|
|
onEnd: (evt) => { |
|
|
|
onEnd: (evt) => { |
|
|
|
const { oldIndex, newIndex } = evt |
|
|
|
const { oldIndex, newIndex } = evt |
|
|
|