Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
34e69e55
Commit
34e69e55
authored
Jan 03, 2018
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor formatter
parent
60a768de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
src/common/menu.js
src/common/menu.js
+7
-13
No files found.
src/common/menu.js
View file @
34e69e55
...
@@ -115,22 +115,16 @@ const menuData = [{
...
@@ -115,22 +115,16 @@ const menuData = [{
}];
}];
function
formatter
(
data
,
parentPath
=
''
)
{
function
formatter
(
data
,
parentPath
=
''
)
{
const
list
=
[];
return
data
.
map
((
item
)
=>
{
data
.
forEach
((
item
)
=>
{
const
result
=
{
...
item
,
path
:
`
${
parentPath
}${
item
.
path
}
`
,
};
if
(
item
.
children
)
{
if
(
item
.
children
)
{
list
.
push
({
result
.
children
=
formatter
(
item
.
children
,
`
${
parentPath
}${
item
.
path
}
/`
);
...
item
,
path
:
`
${
parentPath
}${
item
.
path
}
`
,
children
:
formatter
(
item
.
children
,
`
${
parentPath
}${
item
.
path
}
/`
),
});
}
else
{
list
.
push
({
...
item
,
path
:
`
${
parentPath
}${
item
.
path
}
`
,
});
}
}
return
result
;
});
});
return
list
;
}
}
export
const
getMenuData
=
()
=>
formatter
(
menuData
);
export
const
getMenuData
=
()
=>
formatter
(
menuData
);
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