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
4893296e
Commit
4893296e
authored
Jan 16, 2018
by
jim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #697 when the menu path is url, the parent path is not spliced
parent
29e87b86
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
src/common/menu.js
src/common/menu.js
+7
-1
src/utils/utils.js
src/utils/utils.js
+8
-0
No files found.
src/common/menu.js
View file @
4893296e
import
{
isUrl
}
from
'
../utils/utils
'
;
const
menuData
=
[{
const
menuData
=
[{
name
:
'
dashboard
'
,
name
:
'
dashboard
'
,
icon
:
'
dashboard
'
,
icon
:
'
dashboard
'
,
...
@@ -120,9 +122,13 @@ const menuData = [{
...
@@ -120,9 +122,13 @@ const menuData = [{
function
formatter
(
data
,
parentPath
=
''
,
parentAuthority
)
{
function
formatter
(
data
,
parentPath
=
''
,
parentAuthority
)
{
return
data
.
map
((
item
)
=>
{
return
data
.
map
((
item
)
=>
{
let
{
path
}
=
item
;
if
(
!
isUrl
(
path
))
{
path
=
parentPath
+
item
.
path
;
}
const
result
=
{
const
result
=
{
...
item
,
...
item
,
path
:
`
${
parentPath
}${
item
.
path
}
`
,
path
,
authority
:
item
.
authority
||
parentAuthority
,
authority
:
item
.
authority
||
parentAuthority
,
};
};
if
(
item
.
children
)
{
if
(
item
.
children
)
{
...
...
src/utils/utils.js
View file @
4893296e
...
@@ -132,3 +132,11 @@ export function getRoutes(path, routerData) {
...
@@ -132,3 +132,11 @@ export function getRoutes(path, routerData) {
});
});
return
renderRoutes
;
return
renderRoutes
;
}
}
/* eslint no-useless-escape:0 */
const
reg
=
/
(((
^https
?
:
(?:\/\/)?)(?:[
-;:&=
\+\$
,
\w]
+@
)?[
A-Za-z0-9.-
]
+|
(?:
www.|
[
-;:&=
\+\$
,
\w]
+@
)[
A-Za-z0-9.-
]
+
)((?:\/[\+
~%
\/
.
\w
-_
]
*
)?\??(?:[
-
\+
=&;%@.
\w
_
]
*
)
#
?(?:[\w]
*
))?)
$/g
;
export
function
isUrl
(
path
)
{
return
reg
.
test
(
path
);
}
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