Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tinyu5
vue2-tools
提交
620222f5
V
vue2-tools
项目概览
Tinyu5
/
vue2-tools
与 Fork 源项目一致
Fork自
inscode / VueJS
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue2-tools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
620222f5
编写于
3月 28, 2024
作者:
T
tinyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:设置菜单控制route
上级
400c96d9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
12 addition
and
9 deletion
+12
-9
src/components/layout/index.vue
src/components/layout/index.vue
+4
-4
src/utils/modules/routeUtils.js
src/utils/modules/routeUtils.js
+8
-5
未找到文件。
src/components/layout/index.vue
浏览文件 @
620222f5
...
@@ -2,13 +2,13 @@
...
@@ -2,13 +2,13 @@
<el-container>
<el-container>
<el-header>
<el-header>
<el-menu
:default-active=
"activeIndex2"
class=
"el-menu-demo"
mode=
"horizontal"
@
select=
"handleSelect"
<el-menu
:default-active=
"activeIndex2"
class=
"el-menu-demo"
mode=
"horizontal"
@
select=
"handleSelect"
background-color=
"#545c64"
text-color=
"#fff"
active-text-color=
"#ffd04b"
>
background-color=
"#545c64"
text-color=
"#fff"
router
active-text-color=
"#ffd04b"
>
<template
v-for=
"(menu, i) in menuList"
>
<template
v-for=
"(menu, i) in menuList"
>
<el-submenu
v-if=
"menu.children"
index=
"2
"
:key=
"`submenu-$
{i}`">
<el-submenu
v-if=
"menu.children"
:index=
"menu.path
"
:key=
"`submenu-$
{i}`">
<template
slot=
"title"
>
{{
menu
.
meta
.
title
}}
</
template
>
<template
slot=
"title"
>
{{
menu
.
meta
.
title
}}
</
template
>
<el-menu-item
v-for=
"(menu2, m) in menu.children"
:key=
"`menu-${i}-${m}`"
:index=
"
`menu-${i}-${m}`
"
>
{{ menu2.meta.title }}
</el-menu-item>
<el-menu-item
v-for=
"(menu2, m) in menu.children"
:key=
"`menu-${i}-${m}`"
:index=
"
menu2.path
"
>
{{ menu2.meta.title }}
</el-menu-item>
</el-submenu>
</el-submenu>
<el-menu-item
v-else
:key=
"`menu-${i}`"
:index=
"
`menu-${i}`
"
><i
:class=
"menu.meta.icon"
></i>
{{ menu.meta.title }}
</el-menu-item>
<el-menu-item
v-else
:key=
"`menu-${i}`"
:index=
"
menu.path
"
><i
:class=
"menu.meta.icon"
></i>
{{ menu.meta.title }}
</el-menu-item>
</template>
</template>
<el-menu-item
index=
"3"
disabled
>
消息中心
</el-menu-item>
<el-menu-item
index=
"3"
disabled
>
消息中心
</el-menu-item>
...
...
src/utils/modules/routeUtils.js
浏览文件 @
620222f5
...
@@ -4,13 +4,16 @@
...
@@ -4,13 +4,16 @@
* @param {Function} processFn 处理函数
* @param {Function} processFn 处理函数
* @returns {Array} 数组数据
* @returns {Array} 数组数据
*/
*/
export
function
coventRouteData
(
list
,
processFn
)
{
export
function
coventRouteData
(
list
,
processFn
,
Parentpath
=
"
/
"
)
{
return
list
.
map
(
item
=>
{
return
list
.
map
(
item
=>
{
let
{
children
,
component
,
...
rest
}
=
item
;
let
{
children
,
path
,
component
,
...
rest
}
=
item
;
if
(
!
path
.
startsWith
(
'
/
'
)){
path
=
Parentpath
+
path
}
if
(
children
&&
Array
.
isArray
(
children
))
{
if
(
children
&&
Array
.
isArray
(
children
))
{
children
=
coventRouteData
(
children
,
processFn
)
children
=
coventRouteData
(
children
,
processFn
,
`
${
path
}
/`
)
return
processFn
({
children
,
...
rest
})
return
processFn
({
children
,
path
,
...
rest
})
}
}
return
processFn
(
rest
)
return
processFn
(
{
path
,
...
rest
}
)
});
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录