From e543372cc70a19ff2630c79d8421c2c593e54e5f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 02 六月 2021 17:15:21 +0800 Subject: [PATCH] 2021-06-02 --- src/templates/sharecomponent/columncomponent/dragcolumn/card.jsx | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/templates/sharecomponent/columncomponent/dragcolumn/card.jsx b/src/templates/sharecomponent/columncomponent/dragcolumn/card.jsx index 07b39a2..f98d56e 100644 --- a/src/templates/sharecomponent/columncomponent/dragcolumn/card.jsx +++ b/src/templates/sharecomponent/columncomponent/dragcolumn/card.jsx @@ -3,7 +3,7 @@ import { Icon, Popover } from 'antd' import './index.scss' -const Card = ({ id, card, showfield, moveCard, findCard, editCard, delCard, markCard, hasDrop }) => { +const Card = ({ id, card, showfield, moveCard, findCard, editCard, delCard, markCard }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ item: { type: 'columns', id, originalIndex }, @@ -15,17 +15,15 @@ accept: 'columns', canDrop: () => true, drop: (item) => { - if (!item.hasOwnProperty('originalIndex')) { - hasDrop(card) - } - }, - hover({ id: draggedId }) { - if (!draggedId) return - if (draggedId !== id) { + const { id: draggedId, originalIndex } = item + + if (originalIndex === undefined) { + item.dropTargetId = id + } else if (draggedId && draggedId !== id) { const { index: overIndex } = findCard(id) moveCard(draggedId, overIndex) } - }, + } }) const opacity = isDragging ? 0 : 1 -- Gitblit v1.8.0