Skip to content

Commit 3c683a7

Browse files
authored
fix: table drag register event (Tencent#5140)
1 parent ca22399 commit 3c683a7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/components/table/hooks/useDragSort.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ export default function useDragSort(
6464

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

0 commit comments

Comments
 (0)