在onDragEnd上获取其他数据的方法-react-beutiful-dnd

时间:2019-04-09 14:36:50

标签: react-beautiful-dnd

onDragEnd的正常响应是这样的。

        {
            'draggableId': '2',
            'type': 'DEFAULT',
            'source': {
                'index': 0,
                'droppableId': '1'
            },
            'mode': 'FLUID',
            'destination': {
                'droppableId': '2',
                'index': 0
            },
            'combine': null,
            'reason': 'DROP'
        };

有什么方法可以将其他参数传递给可拖动组件,以便可以在onDragEnd中获取它们。

    {
        'draggableId': '2',
        'type': 'DEFAULT',
        'source': {
            'index': 0,
            'droppableId': '1'
        },
        'mode': 'FLUID',
        'destination': {
            'droppableId': '2',
            'index': 0
        },
        'combine': null,
        'reason': 'DROP'

        data: {
          cardSpecificKey : value
        }
    };

这将是有帮助的,这样,我不必再次读取状态即可获取那些必需的数据。

0 个答案:

没有答案