Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
ant-admin-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit bb3a56b0
authored
2018-01-23 17:00:16 +0800
by
ethanlamzs
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
树形控件的父节点 beta
1 parent
608ccd23
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
mock/linkman.js
src/routes/devutil/schoolmgr.js
mock/linkman.js
View file @
bb3a56b
...
...
@@ -7,11 +7,25 @@ export const linkmangroups = [
},
{
"id"
:
3
,
"name"
:
'分组2'
,
"name"
:
'分组3'
,
"parentid"
:
1
,
"order"
:
10
,
"children"
:[
{
"id"
:
13
,
"name"
:
'分组13'
,
"parentid"
:
1
,
"order"
:
10
},
{
"id"
:
14
,
"name"
:
'分组14'
,
"parentid"
:
1
,
"order"
:
10
}
]
},
{
"id"
:
4
,
"name"
:
'分组4'
,
"parentid"
:
1
,
...
...
src/routes/devutil/schoolmgr.js
View file @
bb3a56b
...
...
@@ -45,11 +45,7 @@ const TreeNode = Tree.TreeNode;
export
default
class
schoolmgr
extends
Component
{
state
=
{
groups
:
[
{
title
:
'Expand to load'
,
key
:
'0'
},
{
title
:
'Expand to load'
,
key
:
'1'
},
{
title
:
'Tree Node'
,
key
:
'2'
,
isLeaf
:
true
},
],
};
...
...
@@ -60,6 +56,7 @@ export default class schoolmgr extends Component{
dispatch
({
type
:
'linkman/groups'
,
});
}
...
...
@@ -87,12 +84,12 @@ export default class schoolmgr extends Component{
return
data
.
map
((
item
)
=>
{
if
(
item
.
children
)
{
return
(
<
TreeNode
title
=
{
item
.
title
}
key
=
{
item
.
key
}
dataRef
=
{
item
}
>
<
TreeNode
title
=
{
item
.
name
}
key
=
{
item
.
id
}
dataRef
=
{
item
}
>
{
this
.
renderTreeNodes
(
item
.
children
)}
<
/TreeNode
>
);
}
return
<
TreeNode
{...
item
}
dataRef
=
{
item
}
/>
;
return
<
TreeNode
title
=
{
item
.
name
}
key
=
{
item
.
id
}
dataRef
=
{
item
}
/>
;
});
}
...
...
@@ -108,6 +105,11 @@ export default class schoolmgr extends Component{
style
:
{
marginBottom
:
24
},
};
const
{
linkman
:{
groups
}}
=
this
.
props
;
console
.
log
(
'render()'
);
console
.
log
(
groups
);
return
<
div
>
<
Row
gutter
=
{
24
}
>
...
...
@@ -137,7 +139,7 @@ export default class schoolmgr extends Component{
<
Col
xl
=
{
16
}
lg
=
{
24
}
md
=
{
24
}
sm
=
{
24
}
xs
=
{
24
}
>
<
div
>
<
Tree
checkable
loadData
=
{
this
.
onLoadData
}
>
{
this
.
renderTreeNodes
(
this
.
state
.
groups
)}
{
this
.
renderTreeNodes
(
groups
)}
<
/Tree
>
<
/div
>
<
/Col
>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment