Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
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
liyang
sts网站
Commits
c43f9bc3
Commit
c43f9bc3
authored
Jul 24, 2021
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
顶部菜单排除隐藏的默认路由
parent
46b43b1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
index.vue
ruoyi-ui/src/components/TopNav/index.vue
+13
-2
index.js
ruoyi-ui/src/router/index.js
+0
-2
No files found.
ruoyi-ui/src/components/TopNav/index.vue
View file @
c43f9bc3
...
...
@@ -87,7 +87,7 @@ export default {
// 默认激活的菜单
activeMenu
()
{
const
path
=
this
.
$route
.
path
;
let
activePath
=
this
.
routers
[
0
].
path
;
let
activePath
=
this
.
defaultRouter
()
;
if
(
path
.
lastIndexOf
(
"/"
)
>
0
)
{
const
tmpPath
=
path
.
substring
(
1
,
path
.
length
);
activePath
=
"/"
+
tmpPath
.
substring
(
0
,
tmpPath
.
indexOf
(
"/"
));
...
...
@@ -100,7 +100,7 @@ export default {
}
var
routes
=
this
.
activeRoutes
(
activePath
);
if
(
routes
.
length
===
0
)
{
activePath
=
this
.
currentIndex
||
this
.
routers
[
0
].
path
activePath
=
this
.
currentIndex
||
this
.
defaultRouter
()
this
.
activeRoutes
(
activePath
);
}
return
activePath
;
...
...
@@ -121,6 +121,17 @@ export default {
const
width
=
document
.
body
.
getBoundingClientRect
().
width
/
3
;
this
.
visibleNumber
=
parseInt
(
width
/
85
);
},
// 默认激活的路由
defaultRouter
()
{
let
router
;
Object
.
keys
(
this
.
routers
).
some
((
key
)
=>
{
if
(
!
this
.
routers
[
key
].
hidden
)
{
router
=
this
.
routers
[
key
].
path
;
return
true
;
}
});
return
router
;
},
// 菜单选择事件
handleSelect
(
key
,
keyPath
)
{
this
.
currentIndex
=
key
;
...
...
ruoyi-ui/src/router/index.js
View file @
c43f9bc3
...
...
@@ -5,8 +5,6 @@ Vue.use(Router)
/* Layout */
import
Layout
from
'@/layout'
import
ParentView
from
'@/components/ParentView'
;
import
InnerLink
from
'@/layout/components/InnerLink'
/**
* Note: 路由配置项
...
...
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