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
7c1e9d41
Commit
7c1e9d41
authored
Feb 11, 2019
by
ιε°θͺ
Committed by
ιεΈ
Feb 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Route authority attribute behavior (#3514)
parent
bb045ead
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+23
-14
No files found.
src/layouts/BasicLayout.js
View file @
7c1e9d41
...
@@ -88,20 +88,29 @@ class BasicLayout extends React.Component {
...
@@ -88,20 +88,29 @@ class BasicLayout extends React.Component {
return
breadcrumbNameMap
[
pathKey
];
return
breadcrumbNameMap
[
pathKey
];
};
};
getRouterAuthority
=
(
pathname
,
routeData
)
=>
{
getRouteAuthority
=
(
pathname
,
routeData
)
=>
{
let
routeAuthority
=
[
'
noAuthority
'
];
const
routes
=
routeData
.
slice
();
// clone
const
getAuthority
=
(
key
,
routes
)
=>
{
let
authorities
;
routes
.
forEach
(
route
=>
{
if
(
route
.
path
&&
pathToRegexp
(
route
.
path
).
test
(
key
))
{
while
(
routes
.
length
>
0
)
{
routeAuthority
=
route
.
authority
;
const
route
=
routes
.
shift
();
}
else
if
(
route
.
routes
)
{
// check partial route
routeAuthority
=
getAuthority
(
key
,
route
.
routes
);
if
(
pathToRegexp
(
`
${
route
.
path
}
(.*)`
).
test
(
pathname
))
{
if
(
route
.
authority
)
{
authorities
=
route
.
authority
;
}
}
return
route
;
// is exact route?
});
if
(
pathToRegexp
(
route
.
path
).
test
(
pathname
))
{
return
routeAuthority
;
break
;
};
}
return
getAuthority
(
pathname
,
routeData
);
if
(
route
.
routes
)
{
route
.
routes
.
forEach
(
r
=>
routes
.
push
(
r
));
}
}
}
return
authorities
;
};
};
getPageTitle
=
(
pathname
,
breadcrumbNameMap
)
=>
{
getPageTitle
=
(
pathname
,
breadcrumbNameMap
)
=>
{
...
@@ -161,7 +170,7 @@ class BasicLayout extends React.Component {
...
@@ -161,7 +170,7 @@ class BasicLayout extends React.Component {
}
=
this
.
props
;
}
=
this
.
props
;
const
isTop
=
PropsLayout
===
'
topmenu
'
;
const
isTop
=
PropsLayout
===
'
topmenu
'
;
const
routerConfig
=
this
.
getRoute
r
Authority
(
pathname
,
routes
);
const
routerConfig
=
this
.
getRouteAuthority
(
pathname
,
routes
);
const
contentStyle
=
!
fixedHeader
?
{
paddingTop
:
0
}
:
{};
const
contentStyle
=
!
fixedHeader
?
{
paddingTop
:
0
}
:
{};
const
layout
=
(
const
layout
=
(
<
Layout
>
<
Layout
>
...
...
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