feat: limit the drag range of tabs, fixed #4640 (#4659)

This commit is contained in:
Netfan
2024-10-17 14:11:42 +08:00
committed by GitHub
parent 719c9a8f2d
commit c432e0ac33
3 changed files with 16 additions and 2 deletions

View File

@@ -81,7 +81,14 @@ export function useTabsDrag(props: TabsProps, emit: EmitType) {
},
onMove(evt) {
const parent = findParentElement(evt.related);
return parent?.classList.contains('draggable') && props.draggable;
if (parent?.classList.contains('draggable') && props.draggable) {
const isCurrentAffix = evt.dragged.classList.contains('affix-tab');
const isRelatedAffix = evt.related.classList.contains('affix-tab');
// 不允许在固定的tab和非固定的tab之间互相拖拽
return isCurrentAffix === isRelatedAffix;
} else {
return false;
}
},
onStart: () => {
el.style.cursor = 'grabbing';