Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
f3348486
Commit
f3348486
authored
Dec 08, 2021
by
邓超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改表过拖拽功能
parent
3d10d01c
Pipeline
#39724
passed with stages
in 28 minutes 38 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
DraggableBodyRow.jsx
src/components/DragTable/DraggableBodyRow.jsx
+7
-4
index.less
src/components/DragTable/index.less
+8
-0
No files found.
src/components/DragTable/DraggableBodyRow.jsx
View file @
f3348486
import
React
,
{
useRef
,
useState
,
useEffect
}
from
'react'
;
import
React
,
{
useRef
,
useState
,
useEffect
}
from
'react'
;
import
{
useDrag
,
useDrop
}
from
'react-dnd'
;
import
{
useDrag
,
useDrop
}
from
'react-dnd'
;
import
'./index.less'
;
import
classnames
from
'classnames'
;
import
styles
from
'./index.less'
;
const
DraggableBodyRow
=
({
const
DraggableBodyRow
=
({
name
,
name
,
...
@@ -30,7 +31,7 @@ const DraggableBodyRow = ({
...
@@ -30,7 +31,7 @@ const DraggableBodyRow = ({
isOver
:
monitor
.
isOver
(),
isOver
:
monitor
.
isOver
(),
canDrop
:
monitor
.
canDrop
(),
canDrop
:
monitor
.
canDrop
(),
dropClassName
:
dropClassName
:
dragIndex
<
index
?
'
drop-over-downward'
:
'
drop-over-upward'
,
dragIndex
<
index
?
'
drop-over-downward'
:
'
drop-over-upward'
,
};
};
},
},
drop
:
item
=>
{
drop
:
item
=>
{
...
@@ -45,11 +46,13 @@ const DraggableBodyRow = ({
...
@@ -45,11 +46,13 @@ const DraggableBodyRow = ({
}),
}),
});
});
drop
(
drag
(
ref
));
drop
(
drag
(
ref
));
return
(
return
(
<
tr
<
tr
ref=
{
ref
}
ref=
{
ref
}
className=
{
`${className}${isOver ? dropClassName : ''}`
}
className=
{
classnames
({
[
className
]:
true
,
[
styles
[
dropClassName
]]:
isOver
,
})
}
style=
{
{
cursor
:
'move'
,
...
style
}
}
style=
{
{
cursor
:
'move'
,
...
style
}
}
{
...
restProps
}
{
...
restProps
}
/>
/>
...
...
src/components/DragTable/index.less
View file @
f3348486
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment