From ff4295358a99b2d35265a5fed445e4407cf6ed9a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 18 五月 2020 14:48:10 +0800 Subject: [PATCH] 2020-05-18 --- src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx b/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx index e6bc7fc..ce0e89e 100644 --- a/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx +++ b/src/templates/sharecomponent/cardcomponent/dragdetail/index.jsx @@ -5,8 +5,8 @@ import Card from './card' import './index.scss' -const Container = ({list, handleList, handleMenu, deleteMenu }) => { - const [cards, setCards] = useState(list) +const Container = ({cardObj, handleList, handleMenu, deleteMenu }) => { + const [cards, setCards] = useState(cardObj.details) const moveCard = (id, atIndex) => { const { card, index } = findCard(id) const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) @@ -14,8 +14,8 @@ handleList(_cards) } - if (!is(fromJS(cards), fromJS(list))) { - setCards(list) + if (!is(fromJS(cards), fromJS(cardObj.details))) { + setCards(cardObj.details) } const findCard = id => { @@ -30,8 +30,13 @@ accept: 'detail' }) + let marginLeft = 0 + if (cardObj.subelement.includes('avatar')) { + marginLeft = 48 + } + return ( - <div ref={drop} className="ant-card-meta-detail" style={{marginLeft: 48}}> + <div ref={drop} className="ant-card-meta-detail" style={{marginLeft: marginLeft}}> {cards.map(card => ( <Card key={card.uuid} -- Gitblit v1.8.0