Skip to content

Commit

Permalink
fix: table drag register event (#5140)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wesley-0808 authored Mar 9, 2025
1 parent ca22399 commit 3c683a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/components/table/hooks/useDragSort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export default function useDragSort(

// 行拖拽排序
const registerRowDragEvent = (element: HTMLDivElement): void => {
if (!isRowHandlerDraggable.value && !isRowDraggable.value) return;
/**
* fix: https://github.com/Tencent/tdesign-vue-next/issues/4985
* 若table内容未渲染(即element子元素为空),拖拽事件不注册
*/
if (element?.children?.length === 0 && !isRowHandlerDraggable.value && !isRowDraggable.value) return;
const dragContainer = element?.querySelector('tbody');
if (!dragContainer) {
console.error('tbody does not exist.');
Expand Down

0 comments on commit 3c683a7

Please sign in to comment.