Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-3
Overview
Overview
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
office
haoban-3
Commits
f8bb7c07
Commit
f8bb7c07
authored
May 07, 2022
by
caoyanzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 菜单框架
parent
9945ba49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
index.vue
src/components/layout/index.vue
+25
-0
No files found.
src/components/layout/index.vue
View file @
f8bb7c07
...
...
@@ -37,6 +37,10 @@ export default {
};
},
created
()
{
this
.
$router
.
beforeEach
((
to
,
from
,
next
)
=>
{
this
.
activedMenu
=
this
.
getActivedMenu
(
this
.
getMenuByPath
(
to
.
path
.
slice
(
1
)));
next
();
});
this
.
getMenuList
();
},
methods
:
{
...
...
@@ -51,6 +55,7 @@ export default {
this
.
menuList
=
result
;
this
.
flatMenuList
=
this
.
getFlatMenuList
(
result
);
this
.
activedMenu
=
this
.
getActivedMenu
(
this
.
getMenuByPath
(
this
.
$route
.
path
.
slice
(
1
)));
this
.
setIndexRoute
(
result
);
});
},
getFlatMenuList
(
menuList
)
{
...
...
@@ -73,6 +78,26 @@ export default {
},
getMenuByPath
(
path
)
{
return
this
.
flatMenuList
.
find
(
el
=>
el
.
menuUrl
==
path
)
||
{};
},
setIndexRoute
(
menuList
)
{
let
path
=
''
;
menuList
.
some
(
first
=>
{
if
(
first
.
hasRight
&&
first
.
isShow
&&
Array
.
isArray
(
first
.
childList
))
{
first
.
childList
.
some
(
second
=>
{
if
(
second
.
hasRight
&&
second
.
isShow
&&
Array
.
isArray
(
second
.
childList
))
{
second
.
childList
.
some
(
third
=>
{
if
(
third
.
hasRight
&&
third
.
isShow
)
{
path
=
third
.
menuUrl
;
}
return
third
.
hasRight
&&
third
.
isShow
;
});
}
return
path
;
});
}
return
path
;
});
this
.
$router
.
addRoutes
([{
path
:
'/'
,
redirect
:
'/'
+
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