Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
InJoyU
vue-element-admin
提交
a932272b
V
vue-element-admin
项目概览
InJoyU
/
vue-element-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-element-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a932272b
编写于
10月 26, 2017
作者:
P
Pan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor:router
上级
577e4dc1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
122 addition
and
85 deletion
+122
-85
src/router/index.js
src/router/index.js
+108
-73
src/views/layout/components/Levelbar.vue
src/views/layout/components/Levelbar.vue
+4
-4
src/views/layout/components/SidebarItem.vue
src/views/layout/components/SidebarItem.vue
+10
-8
未找到文件。
src/router/index.js
浏览文件 @
a932272b
...
...
@@ -11,30 +11,40 @@ import Layout from '../views/layout/Layout'
/**
* icon : the icon show in the sidebar
* hidden : if `hidden:true` will not show in the sidebar
* title : the name show in submenu and levelbar
* redirect : if `redirect:noredirect` will no redirct in the levelbar
* noDropdown : if `noDropdown:true` will has no submenu
* meta : { role: ['admin'] } will control the page role
**/
export
const
constantRouterMap
=
[
{
path
:
'
/login
'
,
component
:
_import
(
'
login/index
'
),
hidden
:
true
},
{
path
:
'
/authredirect
'
,
component
:
_import
(
'
login/authredirect
'
),
hidden
:
true
},
{
path
:
'
/404
'
,
component
:
_import
(
'
errorPage/404
'
),
hidden
:
true
},
{
path
:
'
/401
'
,
component
:
_import
(
'
errorPage/401
'
),
hidden
:
true
},
{
path
:
'
/login
'
,
component
:
_import
(
'
login/index
'
),
hidden
:
true
},
{
path
:
'
/authredirect
'
,
component
:
_import
(
'
login/authredirect
'
),
hidden
:
true
},
{
path
:
'
/404
'
,
component
:
_import
(
'
errorPage/404
'
),
hidden
:
true
},
{
path
:
'
/401
'
,
component
:
_import
(
'
errorPage/401
'
),
hidden
:
true
},
{
path
:
'
/
'
,
component
:
Layout
,
redirect
:
'
/dashboard
'
,
name
:
'
首页
'
,
hidden
:
true
,
children
:
[{
path
:
'
dashboard
'
,
component
:
_import
(
'
dashboard/index
'
)
}]
children
:
[{
path
:
'
dashboard
'
,
component
:
_import
(
'
dashboard/index
'
),
name
:
'
dashboard
'
,
meta
:
{
title
:
'
首页
'
}
}]
},
{
path
:
'
/introduction
'
,
component
:
Layout
,
redirect
:
'
/introduction/index
'
,
icon
:
'
people
'
,
noDropdown
:
true
,
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
introduction/index
'
),
name
:
'
简述
'
}]
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
introduction/index
'
),
name
:
'
introduction
'
,
meta
:
{
title
:
'
简述
'
,
icon
:
'
people
'
}
}]
}
]
...
...
@@ -49,137 +59,162 @@ export const asyncRouterMap = [
path
:
'
/permission
'
,
component
:
Layout
,
redirect
:
'
/permission/index
'
,
name
:
'
权限测试
'
,
icon
:
'
lock
'
,
meta
:
{
role
:
[
'
admin
'
]
},
noDropdown
:
true
,
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
permission/index
'
),
name
:
'
权限测试页
'
,
meta
:
{
role
:
[
'
admin
'
]
}}]
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
permission/index
'
),
name
:
'
permission
'
,
meta
:
{
title
:
'
权限测试页
'
,
icon
:
'
lock
'
,
role
:
[
'
admin
'
]
}
}]
},
{
path
:
'
/icon
'
,
component
:
Layout
,
icon
:
'
icon
'
,
noDropdown
:
true
,
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
svg-icons/index
'
),
name
:
'
icons
'
}]
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
svg-icons/index
'
),
name
:
'
icons
'
,
meta
:
{
title
:
'
图标
'
,
icon
:
'
icon
'
}
}]
},
{
path
:
'
/components
'
,
component
:
Layout
,
redirect
:
'
/components/index
'
,
name
:
'
组件
'
,
icon
:
'
component
'
,
name
:
'
components
'
,
meta
:
{
title
:
'
组件
'
,
icon
:
'
component
'
},
children
:
[
{
path
:
'
index
'
,
component
:
_import
(
'
components/index
'
),
name
:
'
介绍
'
},
{
path
:
'
tinymce
'
,
component
:
_import
(
'
components/tinymce
'
),
name
:
'
富文本编辑器
'
},
{
path
:
'
markdown
'
,
component
:
_import
(
'
components/markdown
'
),
name
:
'
Markdown
'
},
{
path
:
'
json
editor
'
,
component
:
_import
(
'
components/jsonEditor
'
),
name
:
'
JSON编辑器
'
},
{
path
:
'
dnd
list
'
,
component
:
_import
(
'
components/dndList
'
),
name
:
'
列表拖拽
'
},
{
path
:
'
splitpane
'
,
component
:
_import
(
'
components/splitpane
'
),
name
:
'
SplitPane
'
},
{
path
:
'
avatar
upload
'
,
component
:
_import
(
'
components/avatarUpload
'
),
name
:
'
头像上传
'
},
{
path
:
'
dropzone
'
,
component
:
_import
(
'
components/dropzone
'
),
name
:
'
Dropzone
'
},
{
path
:
'
sticky
'
,
component
:
_import
(
'
components/sticky
'
),
name
:
'
Sticky
'
},
{
path
:
'
count
to
'
,
component
:
_import
(
'
components/countTo
'
),
name
:
'
CountTo
'
},
{
path
:
'
mixin
'
,
component
:
_import
(
'
components/mixin
'
),
name
:
'
小组件
'
},
{
path
:
'
back
totop
'
,
component
:
_import
(
'
components/backToTop
'
),
name
:
'
返回顶部
'
}
{
path
:
'
index
'
,
component
:
_import
(
'
components/index
'
),
name
:
'
componentIndex
'
,
meta
:
{
title
:
'
介绍
'
}
},
{
path
:
'
tinymce
'
,
component
:
_import
(
'
components/tinymce
'
),
name
:
'
tinymce
'
,
meta
:
{
title
:
'
富文本编辑器
'
}
},
{
path
:
'
markdown
'
,
component
:
_import
(
'
components/markdown
'
),
name
:
'
markdown
'
,
meta
:
{
title
:
'
Markdown
'
}
},
{
path
:
'
json
-editor
'
,
component
:
_import
(
'
components/jsonEditor
'
),
name
:
'
jsonEditor
'
,
meta
:
{
title
:
'
JSON编辑器
'
}
},
{
path
:
'
dnd
-list
'
,
component
:
_import
(
'
components/dndList
'
),
name
:
'
dndList
'
,
meta
:
{
title
:
'
列表拖拽
'
}
},
{
path
:
'
splitpane
'
,
component
:
_import
(
'
components/splitpane
'
),
name
:
'
splitpane
'
,
meta
:
{
title
:
'
SplitPane
'
}
},
{
path
:
'
avatar
-upload
'
,
component
:
_import
(
'
components/avatarUpload
'
),
name
:
'
avatar-upload
'
,
meta
:
{
title
:
'
头像上传
'
}
},
{
path
:
'
dropzone
'
,
component
:
_import
(
'
components/dropzone
'
),
name
:
'
dropzone
'
,
meta
:
{
title
:
'
Dropzone
'
}
},
{
path
:
'
sticky
'
,
component
:
_import
(
'
components/sticky
'
),
name
:
'
sticky
'
,
meta
:
{
title
:
'
Sticky
'
}
},
{
path
:
'
count
-to
'
,
component
:
_import
(
'
components/countTo
'
),
name
:
'
count-to
'
,
meta
:
{
title
:
'
CountTo
'
}
},
{
path
:
'
mixin
'
,
component
:
_import
(
'
components/mixin
'
),
name
:
'
componentMixin
'
,
meta
:
{
title
:
'
小组件
'
}
},
{
path
:
'
back
-to-top
'
,
component
:
_import
(
'
components/backToTop
'
),
name
:
'
backToTop
'
,
meta
:
{
title
:
'
返回顶部
'
}
}
]
},
{
path
:
'
/charts
'
,
component
:
Layout
,
redirect
:
'
/charts/index
'
,
name
:
'
图表
'
,
icon
:
'
chart
'
,
name
:
'
charts
'
,
meta
:
{
title
:
'
图表
'
,
icon
:
'
chart
'
},
children
:
[
{
path
:
'
index
'
,
component
:
_import
(
'
charts/index
'
),
name
:
'
介绍
'
},
{
path
:
'
keyboard
'
,
component
:
_import
(
'
charts/keyboard
'
),
name
:
'
键盘图表
'
},
{
path
:
'
keyboard2
'
,
component
:
_import
(
'
charts/keyboard2
'
),
name
:
'
键盘图表2
'
},
{
path
:
'
line
'
,
component
:
_import
(
'
charts/line
'
),
name
:
'
折线图
'
},
{
path
:
'
mixchart
'
,
component
:
_import
(
'
charts/mixChart
'
),
name
:
'
混合图表
'
}
{
path
:
'
index
'
,
component
:
_import
(
'
charts/index
'
),
name
:
'
chartsIndex
'
,
meta
:
{
title
:
'
介绍
'
}
},
{
path
:
'
keyboard
'
,
component
:
_import
(
'
charts/keyboard
'
),
name
:
'
keyboard
'
,
meta
:
{
title
:
'
键盘图表
'
}
},
{
path
:
'
keyboard2
'
,
component
:
_import
(
'
charts/keyboard2
'
),
name
:
'
keyboard2
'
,
meta
:
{
title
:
'
键盘图表2
'
}
},
{
path
:
'
line
'
,
component
:
_import
(
'
charts/line
'
),
name
:
'
line
'
,
meta
:
{
title
:
'
折线图
'
}
},
{
path
:
'
mixchart
'
,
component
:
_import
(
'
charts/mixChart
'
),
name
:
'
mixChart
'
,
meta
:
{
title
:
'
混合图表
'
}
}
]
},
{
path
:
'
/example
'
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
name
:
'
综合实例
'
,
icon
:
'
example
'
,
name
:
'
example
'
,
meta
:
{
title
:
'
综合实例
'
,
icon
:
'
example
'
},
children
:
[
{
path
:
'
/example/table
'
,
component
:
_import
(
'
example/table/index
'
),
redirect
:
'
/example/table/table
'
,
name
:
'
Table
'
,
icon
:
'
table
'
,
meta
:
{
title
:
'
Table
'
,
icon
:
'
table
'
},
children
:
[
{
path
:
'
dynamic
table
'
,
component
:
_import
(
'
example/table/dynamictable/index
'
),
name
:
'
动态table
'
},
{
path
:
'
drag
table
'
,
component
:
_import
(
'
example/table/dragTable
'
),
name
:
'
拖拽table
'
},
{
path
:
'
inline
_edit_table
'
,
component
:
_import
(
'
example/table/inlineEditTable
'
),
name
:
'
table内编辑
'
},
{
path
:
'
table
'
,
component
:
_import
(
'
example/table/table
'
),
name
:
'
综合table
'
}
{
path
:
'
dynamic
-table
'
,
component
:
_import
(
'
example/table/dynamicTable/index
'
),
name
:
'
dynamicTable
'
,
meta
:
{
title
:
'
动态table
'
}
},
{
path
:
'
drag
-table
'
,
component
:
_import
(
'
example/table/dragTable
'
),
name
:
'
dragTable
'
,
meta
:
{
title
:
'
拖拽table
'
}
},
{
path
:
'
inline
-edit-table
'
,
component
:
_import
(
'
example/table/inlineEditTable
'
),
name
:
'
inlineEditTable
'
,
meta
:
{
title
:
'
table内编辑
'
}
},
{
path
:
'
table
'
,
component
:
_import
(
'
example/table/table
'
),
name
:
'
tableDemo
'
,
meta
:
{
title
:
'
综合table
'
}
}
]
},
{
path
:
'
form/edit
'
,
icon
:
'
form
'
,
component
:
_import
(
'
example/form
'
),
name
:
'
编辑Form
'
,
meta
:
{
isEdit
:
true
}},
{
path
:
'
form/
create
'
,
icon
:
'
form
'
,
component
:
_import
(
'
example/form
'
),
name
:
'
创建Form
'
},
{
path
:
'
tab/index
'
,
icon
:
'
tab
'
,
component
:
_import
(
'
example/tab/index
'
),
name
:
'
Tab
'
}
{
path
:
'
tab/index
'
,
icon
:
'
tab
'
,
component
:
_import
(
'
example/tab/index
'
),
name
:
'
tab
'
,
meta
:
{
title
:
'
Tab
'
}},
{
path
:
'
form/
edit
'
,
icon
:
'
form
'
,
component
:
_import
(
'
example/form
'
),
name
:
'
formEdit
'
,
meta
:
{
title
:
'
编辑Form
'
,
isEdit
:
true
}
},
{
path
:
'
form/create
'
,
icon
:
'
form
'
,
component
:
_import
(
'
example/form
'
),
name
:
'
FormCreate
'
,
meta
:
{
title
:
'
创建Form
'
}
}
]
},
{
path
:
'
/error
'
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
name
:
'
错误页面
'
,
icon
:
'
404
'
,
name
:
'
errorPages
'
,
meta
:
{
title
:
'
错误页面
'
,
icon
:
'
404
'
},
children
:
[
{
path
:
'
401
'
,
component
:
_import
(
'
errorPage/401
'
),
name
:
'
401
'
},
{
path
:
'
404
'
,
component
:
_import
(
'
errorPage/404
'
),
name
:
'
404
'
}
{
path
:
'
401
'
,
component
:
_import
(
'
errorPage/401
'
),
name
:
'
401
'
,
meta
:
{
title
:
'
401
'
}
},
{
path
:
'
404
'
,
component
:
_import
(
'
errorPage/404
'
),
name
:
'
404
'
,
meta
:
{
title
:
'
404
'
}
}
]
},
{
path
:
'
/errlog
'
,
path
:
'
/err
or-
log
'
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
name
:
'
errlog
'
,
icon
:
'
bug
'
,
noDropdown
:
true
,
children
:
[{
path
:
'
log
'
,
component
:
_import
(
'
errlog/index
'
),
name
:
'
错误日志
'
}]
children
:
[{
path
:
'
log
'
,
component
:
_import
(
'
errlog/index
'
),
name
:
'
errorLog
'
,
meta
:
{
title
:
'
错误日志
'
,
icon
:
'
bug
'
}}]
},
{
path
:
'
/excel
'
,
component
:
Layout
,
redirect
:
'
/excel/download
'
,
name
:
'
excel
'
,
icon
:
'
excel
'
,
meta
:
{
title
:
'
excel
'
,
icon
:
'
excel
'
},
children
:
[
{
path
:
'
download
'
,
component
:
_import
(
'
excel/index
'
),
name
:
'
export excel
'
},
{
path
:
'
download2
'
,
component
:
_import
(
'
excel/selectExcel
'
),
name
:
'
export selected
'
},
{
path
:
'
upload
'
,
component
:
_import
(
'
excel/uploadExcel
'
),
name
:
'
upload excel
'
}
{
path
:
'
export-excel
'
,
component
:
_import
(
'
excel/index
'
),
name
:
'
exportExcel
'
,
meta
:
{
title
:
'
export excel
'
}
},
{
path
:
'
export-selected-excel
'
,
component
:
_import
(
'
excel/selectExcel
'
),
name
:
'
selectExcel
'
,
meta
:
{
title
:
'
export selected
'
}
},
{
path
:
'
upload
-excel
'
,
component
:
_import
(
'
excel/uploadExcel
'
),
name
:
'
uploadExcel
'
,
meta
:
{
title
:
'
upload excel
'
}
}
]
},
{
path
:
'
/zip
'
,
component
:
Layout
,
redirect
:
'
/zip/download
'
,
name
:
'
zip
'
,
icon
:
'
zip
'
,
children
:
[
{
path
:
'
download
'
,
component
:
_import
(
'
zip/index
'
),
name
:
'
export zip
'
}
]
children
:
[{
path
:
'
download
'
,
component
:
_import
(
'
zip/index
'
),
name
:
'
exportZip
'
,
meta
:
{
title
:
'
zip
'
,
icon
:
'
zip
'
}}]
},
{
path
:
'
/theme
'
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
name
:
'
theme
'
,
icon
:
'
theme
'
,
noDropdown
:
true
,
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
theme/index
'
),
name
:
'
换肤
'
}]
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
theme/index
'
),
name
:
'
theme
'
,
meta
:
{
title
:
'
换肤
'
,
icon
:
'
theme
'
}}]
},
{
path
:
'
/clipboard
'
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
icon
:
'
clipboard
'
,
noDropdown
:
true
,
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
clipboard/index
'
),
name
:
'
clipboard
'
}]
children
:
[{
path
:
'
index
'
,
component
:
_import
(
'
clipboard/index
'
),
name
:
'
clipboard
'
,
meta
:
{
title
:
'
clipboard
'
,
icon
:
'
clipboard
'
}}]
},
{
path
:
'
*
'
,
redirect
:
'
/404
'
,
hidden
:
true
}
...
...
src/views/layout/components/Levelbar.vue
浏览文件 @
a932272b
<
template
>
<el-breadcrumb
class=
"app-levelbar"
separator=
"/"
>
<el-breadcrumb-item
v-for=
"(item,index) in levelList"
:key=
"item.path"
>
<span
v-if=
'item.redirect==="noredirect"||index==levelList.length-1'
class=
"no-redirect"
>
{{
item
.
nam
e
}}
</span>
<router-link
v-else
:to=
"item.redirect||item.path"
>
{{
item
.
nam
e
}}
</router-link>
<el-breadcrumb-item
v-for=
"(item,index) in levelList"
:key=
"item.path"
v-if=
'item.meta.title'
>
<span
v-if=
'item.redirect==="noredirect"||index==levelList.length-1'
class=
"no-redirect"
>
{{
item
.
meta
.
titl
e
}}
</span>
<router-link
v-else
:to=
"item.redirect||item.path"
>
{{
item
.
meta
.
titl
e
}}
</router-link>
</el-breadcrumb-item>
</el-breadcrumb>
</
template
>
...
...
@@ -22,7 +22,7 @@ export default {
let
matched
=
this
.
$route
.
matched
.
filter
(
item
=>
item
.
name
)
const
first
=
matched
[
0
]
if
(
first
&&
(
first
.
name
!==
'
首页
'
||
first
.
path
!==
''
))
{
matched
=
[{
name
:
'
首页
'
,
path
:
'
/
'
}].
concat
(
matched
)
matched
=
[{
path
:
'
/
'
,
meta
:
{
title
:
'
首页
'
}
}].
concat
(
matched
)
}
this
.
levelList
=
matched
}
...
...
src/views/layout/components/SidebarItem.vue
浏览文件 @
a932272b
...
...
@@ -2,28 +2,30 @@
<div
class=
'menu-wrapper'
>
<template
v-for=
"item in routes"
>
<router-link
v-if=
"!item.hidden&&item.
noDropdown&&item.children.length>0"
:to=
"item.path+'/'+item.children[0].path"
>
<router-link
v-if=
"!item.hidden&&item.
children&&item.children.length===1"
:to=
"item.path+'/'+item.children[0].path"
:key=
'item.children[0].name'
>
<el-menu-item
:index=
"item.path+'/'+item.children[0].path"
class=
'submenu-title-noDropdown'
>
<svg-icon
v-if=
'item.icon'
:icon-class=
"item.icon"
></svg-icon><span>
{{
item
.
children
[
0
].
name
}}
</span>
<svg-icon
v-if=
'item.children[0].meta&&item.children[0].meta.icon'
:icon-class=
"item.children[0].meta.icon"
></svg-icon>
<span>
{{
item
.
children
[
0
].
meta
?
item
.
children
[
0
].
meta
.
title
:
'
no title
'
}}
</span>
</el-menu-item>
</router-link>
<el-submenu
:index=
"item.name"
v-if=
"
!item.noDropdown&&!item.hidden"
>
<el-submenu
:index=
"item.name"
v-if=
"
item.children&&item.children.length>1&&!item.hidden"
:key=
'item.name'
>
<template
slot=
"title"
>
<svg-icon
v-if=
'item.icon'
:icon-class=
"item.icon"
></svg-icon><span>
{{
item
.
name
}}
</span>
<svg-icon
v-if=
'item.meta&&item.meta.icon'
:icon-class=
"item.meta.icon"
></svg-icon>
<span>
{{
item
.
meta
?
item
.
meta
.
title
:
'
no title
'
}}
</span>
</
template
>
<
template
v-for=
"child in item.children"
v-if=
'!child.hidden'
>
<sidebar-item
class=
'nest-menu'
v-if=
'child.children&&child.children.length>0'
:routes=
'[child]'
>
</sidebar-item>
<sidebar-item
class=
'nest-menu'
v-if=
'child.children&&child.children.length>0'
:routes=
'[child]'
:key=
'child.path'
>
</sidebar-item>
<router-link
v-else
:to=
"item.path+'/'+child.path"
>
<router-link
v-else
:to=
"item.path+'/'+child.path"
:key=
'child.name'
>
<el-menu-item
:index=
"item.path+'/'+child.path"
>
<svg-icon
v-if=
'child.icon'
:icon-class=
"child.icon"
></svg-icon><span>
{{
child
.
name
}}
</span>
<svg-icon
v-if=
'child.meta&&child.meta.icon'
:icon-class=
"child.meta.icon"
></svg-icon>
<span
v-if=
'child.meta'
>
{{
child
.
meta
.
title
}}
</span>
</el-menu-item>
</router-link>
</
template
>
</el-submenu>
</template>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录