From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/menu/components/share/searchcomponent/dragsearch/card.jsx | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx index f6f78e3..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 = '' // 涓嬫媺鎼滅储銆佹椂闂磋寖鍥寸被鍨嬶紝鍒濆鍊奸渶瑕侀澶勭悊 @@ -121,8 +127,6 @@ <Form.Item labelCol={{style: {width: labelwidth + '%'}}} wrapperCol={{style: {width: (100 - labelwidth) + '%'}}} - // labelCol={{xs: { span: 24 }, sm: { span: 8 }}} - // wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} label={card.labelShow !== 'false' ? card.label : ''} required={card.required === 'true'} > -- Gitblit v1.8.0