Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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
shenshaokai
jinfa-admin
Commits
a7409a45
Commit
a7409a45
authored
Aug 26, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复选中树形根节点时出现无parentId情况
parent
56807783
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
index.tsx
src/components/TabTree/index.tsx
+2
-2
useTreeTabs.ts
src/hooks/useTreeTabs.ts
+0
-1
No files found.
src/components/TabTree/index.tsx
View file @
a7409a45
...
@@ -205,11 +205,11 @@ const TabTree:React.FC<TabTreeProps> = (props) => {
...
@@ -205,11 +205,11 @@ const TabTree:React.FC<TabTreeProps> = (props) => {
}
}
selfActions
.
getParent
=
(
id
)
=>
{
selfActions
.
getParent
=
(
id
)
=>
{
console
.
log
(
id
)
const
reductData
=
treeReduction
(
treeData
)
const
reductData
=
treeReduction
(
treeData
)
const
targetInfo
=
reductData
[
id
]
const
targetInfo
=
reductData
[
id
]
const
parentInfo
=
reductData
[
targetInfo
.
parentId
]
const
parentInfo
=
reductData
[
targetInfo
.
parentId
]
return
parentInfo
||
null
// fixbug 当选中根节点下的节点时, 由于无parentId, 需自动补充0
return
parentInfo
||
{
id
:
0
}
}
}
}
}
...
...
src/hooks/useTreeTabs.ts
View file @
a7409a45
...
@@ -114,7 +114,6 @@ export const useTreeTabs = (options: useTreeTabOptions = {}) => {
...
@@ -114,7 +114,6 @@ export const useTreeTabs = (options: useTreeTabOptions = {}) => {
const
toolsRender
=
{
const
toolsRender
=
{
addNode
(
node
)
{
addNode
(
node
)
{
const
activeParentId
=
treeActions
&&
treeActions
.
getParent
(
node
.
key
||
node
.
id
)?.
id
const
activeParentId
=
treeActions
&&
treeActions
.
getParent
(
node
.
key
||
node
.
id
)?.
id
console
.
log
(
activeParentId
)
setNodeRecord
({
setNodeRecord
({
...
node
,
...
node
,
parentId
:
activeParentId
,
// 添加同级的时候 使用上一级的id作为parentId
parentId
:
activeParentId
,
// 添加同级的时候 使用上一级的id作为parentId
...
...
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