Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
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
tianzhuanghu
ant-design-pro-vue
Commits
de613635
Unverified
Commit
de613635
authored
Mar 02, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: router alwaysShow rename hideChildrenInMenu
parent
d74030c3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
index.js
src/components/menu/index.js
+5
-3
GlobalLayout.vue
src/components/page/GlobalLayout.vue
+0
-1
router.config.js
src/config/router.config.js
+2
-2
README.md
src/router/README.md
+1
-1
No files found.
src/components/menu/index.js
View file @
de613635
...
...
@@ -66,8 +66,9 @@ export default {
return
h
(
Icon
,
{
props
:
{
...
props
}
})
},
renderMenuItem
:
function
(
h
,
menu
,
pIndex
,
index
)
{
const
target
=
menu
.
meta
.
target
||
null
return
h
(
Item
,
{
key
:
menu
.
path
?
menu
.
path
:
'item_'
+
pIndex
+
'_'
+
index
},
[
h
(
'router-link'
,
{
attrs
:
{
to
:
{
name
:
menu
.
name
}
}
},
[
h
(
'router-link'
,
{
attrs
:
{
to
:
{
name
:
menu
.
name
}
,
target
:
target
}
},
[
this
.
renderIcon
(
h
,
menu
.
meta
.
icon
),
h
(
'span'
,
[
menu
.
meta
.
title
])
])
...
...
@@ -78,7 +79,8 @@ export default {
const
subItem
=
[
h
(
'span'
,
{
slot
:
'title'
},
[
this
.
renderIcon
(
h
,
menu
.
meta
.
icon
),
h
(
'span'
,
[
menu
.
meta
.
title
])])]
const
itemArr
=
[]
const
pIndex_
=
pIndex
+
'_'
+
index
if
(
!
menu
.
alwaysShow
)
{
console
.
log
(
'menu'
,
menu
)
if
(
!
menu
.
hideChildrenInMenu
)
{
menu
.
children
.
forEach
(
function
(
item
,
i
)
{
itemArr
.
push
(
this2_
.
renderItem
(
h
,
item
,
pIndex_
,
i
))
})
...
...
@@ -87,7 +89,7 @@ export default {
},
renderItem
:
function
(
h
,
menu
,
pIndex
,
index
)
{
if
(
!
menu
.
hidden
)
{
return
menu
.
children
&&
!
menu
.
alwaysShow
return
menu
.
children
&&
!
menu
.
hideChildrenInMenu
?
this
.
renderSubMenu
(
h
,
menu
,
pIndex
,
index
)
:
this
.
renderMenuItem
(
h
,
menu
,
pIndex
,
index
)
}
...
...
src/components/page/GlobalLayout.vue
View file @
de613635
...
...
@@ -131,7 +131,6 @@ export default {
},
16
)
})
}
},
methods
:
{
...
mapActions
([
'setSidebar'
]),
...
...
src/config/router.config.js
View file @
de613635
...
...
@@ -80,7 +80,7 @@ export const asyncRouterMap = [
{
path
:
'/list/query-list'
,
name
:
'QueryListWrapper'
,
alwaysShow
:
true
,
// 强制显示 MenuItem 而不是 SubMenu
hideChildrenInMenu
:
true
,
// 强制显示 MenuItem 而不是 SubMenu
component
:
()
=>
import
(
'@/views/list/TableList'
),
meta
:
{
title
:
'查询表格'
,
keepAlive
:
true
,
permission
:
[
'table'
]
}
},
...
...
@@ -257,7 +257,7 @@ export const asyncRouterMap = [
component
:
()
=>
import
(
'@/views/account/settings/Index'
),
meta
:
{
title
:
'个人设置'
,
hideHeader
:
true
,
keepAlive
:
true
,
permission
:
[
'user'
]
},
redirect
:
'/account/settings/base'
,
alwaysShow
:
true
,
hideChildrenInMenu
:
true
,
children
:
[
{
path
:
'/account/settings/base'
,
...
...
src/router/README.md
View file @
de613635
...
...
@@ -42,7 +42,7 @@
| redirect | 重定向地址, 访问这个路由时,自定进行重定向 | string | - |
| name | 路由名称, 必须设置,且不能重名 | string | - |
| meta | 路由元信息(路由附带扩展信息) | object | {} |
|
alwaysShow
| 强制菜单显示为Item而不是SubItem(配合 meta.hidden) | boolean | - |
|
hideChildrenInMenu
| 强制菜单显示为Item而不是SubItem(配合 meta.hidden) | boolean | - |
`{ Meta }`
路由元信息对象
...
...
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