no message

Former-commit-id: ec3e0487ed841a5b53eb7a0b0c43d4c70d48027f
Former-commit-id: fa521d0aefbd457c7e33a414d95757b455e3dac2
Former-commit-id: 9c3751710cc4549ef906b8008488411d1020ad6b
This commit is contained in:
liyang
2018-06-05 13:08:49 +08:00
parent ccdfe68a79
commit a1c60d25ef
3 changed files with 39 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
<template> <template>
<el-menu-item :index="menu.path"> <el-menu-item :index="menu.path">
<i :class="`fa fa-${menu.icon}`"></i> <i v-if="menu.icon" :class="`fa fa-${menu.icon}`"></i>
<span slot="title">{{menu.title}}</span> <span slot="title">{{menu.title}}</span>
</el-menu-item> </el-menu-item>
</template> </template>

View File

@@ -1,7 +1,7 @@
<template> <template>
<el-submenu :index="menu.path"> <el-submenu :index="menu.path">
<template slot="title"> <template slot="title">
<i :class="`fa fa-${menu.icon}`"></i> <i v-if="menu.icon" :class="`fa fa-${menu.icon}`"></i>
<span slot="title">{{menu.title}}</span> <span slot="title">{{menu.title}}</span>
</template> </template>
<template v-for="(child, childIndex) in menu.children"> <template v-for="(child, childIndex) in menu.children">

View File

@@ -2,38 +2,52 @@
<el-menu <el-menu
mode="horizontal" mode="horizontal"
:router="true"> :router="true">
<el-submenu index="2"> <template v-for="(menu, menuIndex) in menus">
<template slot="title">我的工作台</template> <d2-menu-item v-if="menu.children === undefined" :menu="menu" :key="menuIndex"/>
<el-menu-item index="2-1">选项1</el-menu-item> <d2-submenu v-else :menu="menu" :key="menuIndex"/>
<el-menu-item index="2-2">选项2</el-menu-item> </template>
<el-menu-item index="2-3">选项3</el-menu-item>
<el-submenu index="2-4">
<template slot="title">选项4</template>
<el-menu-item index="2-4-1">选项1</el-menu-item>
<el-menu-item index="2-4-2">选项2</el-menu-item>
<el-menu-item index="2-4-3">选项3</el-menu-item>
</el-submenu>
</el-submenu>
<el-menu-item
v-for="menu in menus"
:key="menu.path"
:index="menu.path">
{{menu.title}}
</el-menu-item>
</el-menu> </el-menu>
</template> </template>
<script> <script>
export default { export default {
name: 'HeaderMenu', name: 'HeaderMenu',
components: {
D2MenuItem: () => import('../D2MenuItem/index.vue'),
D2Submenu: () => import('../D2Submenu/index.vue')
},
data () { data () {
return { return {
menus: [ menus: [
{path: '/index', title: '首页'}, {
{path: '/demo/plugins', title: '插件'}, path: '/index',
{path: '/demo/components', title: '组件'}, title: '首页'
{path: '/demo/chart', title: '图表'}, },
{path: '/demo/business', title: '示例业务界面'} {
path: '/demo',
title: '功能',
children: [
{
path: '/demo/plugins',
title: '插件',
icon: 'plug'
},
{
path: '/demo/components',
title: '组件',
icon: 'puzzle-piece'
},
{
path: '/demo/chart',
title: '图表',
icon: 'pie-chart'
}
]
},
{
path: '/demo/business',
title: '示例业务界面'
}
] ]
} }
} }