react antd table react-sortable-hoc DraggableBodyRow 拖拽及禁用指定行拖拽
原文地址:基于antd树形表格table的拖拽排序效果实现 - 掘金 (juejin.cn)
思路片段:
const DraggableBodyRow: React.FC<any> = ({ className, style, ...restProps }) => {
const index = customInfoList.findIndex(
({ order: _index }) => _index === restProps['data-row-key'],
);
// 头两行禁用
if ([0, 1].includes(index)) {
return (
<tr
className={className}
// style={isDrag ? { cursor: 'move', opacity, ...style } : { ...style }}
// data-handler-id={handlerId}
{...restProps}
/>
);
}
return <SortableItem index={index} className={className} {...restProps} />;
};

浙公网安备 33010602011771号