Commit f3348486 authored by 邓超's avatar 邓超

fix: 修改表过拖拽功能

parent 3d10d01c
Pipeline #39724 passed with stages
in 28 minutes 38 seconds
import React, { useRef, useState, useEffect } from 'react';
import { useDrag, useDrop } from 'react-dnd';
import './index.less';
import classnames from 'classnames';
import styles from './index.less';
const DraggableBodyRow = ({
name,
......@@ -30,7 +31,7 @@ const DraggableBodyRow = ({
isOver: monitor.isOver(),
canDrop: monitor.canDrop(),
dropClassName:
dragIndex < index ? ' drop-over-downward' : ' drop-over-upward',
dragIndex < index ? 'drop-over-downward' : 'drop-over-upward',
};
},
drop: item => {
......@@ -45,11 +46,13 @@ const DraggableBodyRow = ({
}),
});
drop(drag(ref));
return (
<tr
ref={ref}
className={`${className}${isOver ? dropClassName : ''}`}
className={classnames({
[className]: true,
[styles[dropClassName]]: isOver,
})}
style={{ cursor: 'move', ...style }}
{...restProps}
/>
......
tr.drop-over-downward td {
border-bottom: 2px dashed #1890ff;
}
tr.drop-over-upward td {
border-top: 2px dashed #1890ff;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment