From da34633b25d16359cd91a656acad5e811f9972b7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 14 三月 2023 18:09:54 +0800 Subject: [PATCH] 2023-03-14 --- src/menu/components/share/searchcomponent/dragsearch/card.jsx | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx index 1a5c88e..2b6bbe1 100644 --- a/src/menu/components/share/searchcomponent/dragsearch/card.jsx +++ b/src/menu/components/share/searchcomponent/dragsearch/card.jsx @@ -21,17 +21,23 @@ const [, drop] = useDrop({ accept: 'search', canDrop: () => true, - drop: ({ id: draggedId }) => { - if (!draggedId || draggedId === id) return - - const { index: originIndex } = findCard(draggedId) - if (originIndex === -1) return - - const { index: overIndex } = findCard(id) - moveCard(draggedId, overIndex) + drop: (item) => { + const { id: draggedId, originalIndex } = item + + if (originalIndex === undefined) { + item.dropTargetId = id + } else { + if (!draggedId || draggedId === id) return + + const { index: originIndex } = findCard(draggedId) + if (originIndex === -1) return + + const { index: overIndex } = findCard(id) + moveCard(draggedId, overIndex) + } } }) - const opacity = isDragging ? 0 : 1 + const opacity = isDragging ? 0.5 : 1 let _defaultValue = '' // 涓嬫媺鎼滅储銆佹椂闂磋寖鍥寸被鍨嬶紝鍒濆鍊奸渶瑕侀澶勭悊 -- Gitblit v1.8.0