From e8b42d8a44fcd534201427ffcbdad290ab05cbf0 Mon Sep 17 00:00:00 2001 From: zhangwenshuai Date: Sat, 11 Jul 2020 18:31:56 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=8B=96=E6=8B=BD=E4=B8=8D=E8=B7=9F?= =?UTF-8?q?=E6=96=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/apolloTable/component/DragSorted.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/apolloTable/component/DragSorted.tsx b/components/apolloTable/component/DragSorted.tsx index e4b9dc4..53b66a7 100644 --- a/components/apolloTable/component/DragSorted.tsx +++ b/components/apolloTable/component/DragSorted.tsx @@ -128,10 +128,18 @@ const DragSorted = (props: any) => { { columnName: dropColumn, orderNo: Number(dropColumnOrder) }, ); } - }, []); + }, [onDropFinish]); // 监听鼠标按下 const onMouseDown = useCallback( (e) => { + // 没有拖拽回调,默认不支持拖拽事件 + if (!onDropFinish) { + return; + } + // 不是左键点击不作处理 + if (e.button !== 0) { + return; + } // 表格初始位置x点 const originLeft = container.getBoundingClientRect().x || 0; // 拖动列矩形 -- 2.21.0