Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
Support
提交反馈
为 GitLab 提交贡献
登录
切换导航
兵
兵役_吉林工业
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
麦嘉得
兵役_吉林工业
提交
61394e57
提交
61394e57
编写于
8月 24, 2018
作者:
Pan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature: [sidebar] add external-link
上级
85c5d600
变更
4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
64 行增加
和
12 行删除
+64
-12
link.svg
src/icons/svg/link.svg
+1
-0
index.js
src/router/index.js
+11
-0
Item.vue
src/views/layout/components/Sidebar/Item.vue
+29
-0
SidebarItem.vue
src/views/layout/components/Sidebar/SidebarItem.vue
+23
-12
未找到文件。
src/icons/svg/link.svg
0 → 100644
浏览文件 @
61394e57
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
t=
"1534846208920"
class=
"icon"
style=
""
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"2941"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"200"
height=
"200"
><defs><style
type=
"text/css"
></style></defs><path
d=
"M912 1008.512H15.488V112h448.256v96H111.488v704.512H816V560.256h96z"
p-id=
"2942"
></path><path
d=
"M918.208 37.888l67.904 67.904L545.984 545.92 478.08 478.08z"
p-id=
"2943"
></path><path
d=
"M1007.168 310.656h-96V112h-208V16h304z"
p-id=
"2944"
></path></svg>
\ No newline at end of file
src/router/index.js
浏览文件 @
61394e57
...
...
@@ -130,6 +130,17 @@ export const constantRouterMap = [
]
},
{
path
:
'
external-link
'
,
component
:
Layout
,
children
:
[
{
path
:
'
https://panjiachen.github.io/vue-element-admin-site/#/
'
,
meta
:
{
title
:
'
externalLink
'
,
icon
:
'
link
'
}
}
]
},
{
path
:
'
*
'
,
redirect
:
'
/404
'
,
hidden
:
true
}
]
...
...
src/views/layout/components/Sidebar/Item.vue
0 → 100644
浏览文件 @
61394e57
<
script
>
export
default
{
name
:
'
MenuItem
'
,
functional
:
true
,
props
:
{
icon
:
{
type
:
String
,
default
:
''
},
title
:
{
type
:
String
,
default
:
''
}
},
render
(
h
,
context
)
{
const
{
icon
,
title
}
=
context
.
props
const
vnodes
=
[]
if
(
icon
)
{
vnodes
.
push
(
<
svg
-
icon
icon
-
class
=
{
icon
}
/>
)
}
if
(
title
)
{
vnodes
.
push
(
<
span
slot
=
'
title
'
>
{(
title
)}
<
/span>
)
}
return
vnodes
}
}
</
script
>
src/views/layout/components/Sidebar/SidebarItem.vue
浏览文件 @
61394e57
<
template
>
<div
v-if=
"!item.hidden&&item.children"
class=
"menu-wrapper"
>
<router-link
v-if=
"hasOneShowingChild(item.children) && !onlyOneChild.children&&!item.alwaysShow"
:to=
"resolvePath(onlyOneChild.path)"
>
<template
v-if=
"hasOneShowingChild(item.children) && !onlyOneChild.children&&!item.alwaysShow"
>
<a
v-if=
"isExternalLink(onlyOneChild.path)"
:href=
"onlyOneChild.path"
target=
"blank"
>
apple
<el-menu-item
:index=
"resolvePath(onlyOneChild.path)"
:class=
"
{'submenu-title-noDropdown':!isNest}">
<svg-icon
v-if=
"onlyOneChild.meta&&onlyOneChild.meta.icon"
:icon-class=
"onlyOneChild.meta.icon"
/>
<span
v-if=
"onlyOneChild.meta&&onlyOneChild.meta.title"
slot=
"title"
>
{{
onlyOneChild
.
meta
.
title
}}
</span>
<item
v-if=
"onlyOneChild.meta"
:icon=
"onlyOneChild.meta.icon"
:title=
"onlyOneChild.meta.title"
/>
</el-menu-item>
</a>
<router-link
v-else
:to=
"resolvePath(onlyOneChild.path)"
>
<el-menu-item
:index=
"resolvePath(onlyOneChild.path)"
:class=
"
{'submenu-title-noDropdown':!isNest}">
<item
v-if=
"onlyOneChild.meta"
:icon=
"onlyOneChild.meta.icon"
:title=
"onlyOneChild.meta.title"
/>
</el-menu-item>
</router-link>
</
template
>
<el-submenu
v-else
:index=
"item.name||item.path"
>
<
template
slot=
"title"
>
<svg-icon
v-if=
"item.meta&&item.meta.icon"
:icon-class=
"item.meta.icon"
/>
<span
v-if=
"item.meta&&item.meta.title"
slot=
"title"
>
{{
item
.
meta
.
title
}}
</span>
<item
v-if=
"item.meta"
:icon=
"item.meta.icon"
:title=
"item.meta.title"
/>
</
template
>
<
template
v-for=
"child in item.children"
v-if=
"!child.hidden"
>
...
...
@@ -25,8 +31,7 @@
<router-link
v-else
:to=
"resolvePath(child.path)"
:key=
"child.name"
>
<el-menu-item
:index=
"resolvePath(child.path)"
>
<svg-icon
v-if=
"child.meta&&child.meta.icon"
:icon-class=
"child.meta.icon"
/>
<span
v-if=
"child.meta&&child.meta.title"
slot=
"title"
>
{{
child
.
meta
.
title
}}
</span>
<item
v-if=
"child.meta"
:icon=
"child.meta.icon"
:title=
"child.meta.title"
/>
</el-menu-item>
</router-link>
</
template
>
...
...
@@ -37,9 +42,12 @@
<
script
>
import
path
from
'
path
'
import
{
validateURL
}
from
'
@/utils/validate
'
import
Item
from
'
./Item
'
export
default
{
name
:
'
SidebarItem
'
,
components
:
{
Item
},
props
:
{
// route配置json
item
:
{
...
...
@@ -76,8 +84,11 @@ export default {
}
return
false
},
resolvePath
(...
paths
)
{
return
path
.
resolve
(
this
.
basePath
,
...
paths
)
resolvePath
(
routePath
)
{
return
path
.
resolve
(
this
.
basePath
,
routePath
)
},
isExternalLink
(
routePath
)
{
return
validateURL
(
routePath
)
}
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录