From 0910b25915cd47cfb5e61dd7382223eac4240d9c Mon Sep 17 00:00:00 2001 From: keno-lee Date: Fri, 11 Oct 2024 19:28:25 +0800 Subject: [PATCH] 1.5.2 --- docs/demos/tree/Drag.vue | 24 ++---- package.json | 2 +- src/VirtGrid.tsx | 1 + src/components/tree/useDrag.ts | 148 +++++++++++++++++++++------------ 4 files changed, 107 insertions(+), 68 deletions(-) diff --git a/docs/demos/tree/Drag.vue b/docs/demos/tree/Drag.vue index 96b4f6c..cd6a949 100644 --- a/docs/demos/tree/Drag.vue +++ b/docs/demos/tree/Drag.vue @@ -54,23 +54,17 @@ function onDragstart() { } function onDragEnd(data: any) { - console.log('onDragend', data); if (data) { - const { node, prevNode, parentNode } = data; - console.log('node', node); - console.log('prevNode', prevNode); - console.log('parentNode', parentNode); + console.log('drag success', data); + // const { node, prevNode, parentNode } = data; + // console.log('drag node', node); + // console.log('target prevNode', prevNode); + // console.log('target parentNode', parentNode); + } else { + console.warn('drag fail: Invalid'); } } -function onBeforeDrag(data: any) { - console.log('onDragMove', data); - if (data.placement === 'center' && data.node.data.id === 3) { - return false; - } - return true; -} - const draggable = ref(true); // setTimeout(() => { @@ -96,18 +90,18 @@ const expandedKeys = ref([1, 100, 102]); v-model:expandedKeys="expandedKeys" :list="list" :fieldNames="customFieldNames" - :indent="28" + :indent="16" :iconSize="14" :filter-method="filterMethod" :itemGap="4" :draggable="draggable" - :beforeDrag="onBeforeDrag" @dragstart="onDragstart" @dragend="onDragEnd" dragOnly dragGhostClass="drag-ghost-class" dragClass="drag-class" expandOnClickNode + default-expand-all >