Merge branch 'master' into deploy
This commit is contained in:
commit
95709f7369
|
@ -4,6 +4,7 @@ dist/
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
**/*.log
|
||||||
|
|
||||||
test/unit/coverage
|
test/unit/coverage
|
||||||
test/e2e/reports
|
test/e2e/reports
|
||||||
|
|
|
@ -29,9 +29,13 @@ export default {
|
||||||
mixChart: 'Mix Chart',
|
mixChart: 'Mix Chart',
|
||||||
example: 'Example',
|
example: 'Example',
|
||||||
nested: 'Nested Routes',
|
nested: 'Nested Routes',
|
||||||
bar: 'Bar',
|
menu1: 'Menu 1',
|
||||||
barProfile: 'Profile',
|
'menu1-1': 'Menu 1-1',
|
||||||
barPosts: 'Posts',
|
'menu1-2': 'Menu 1-2',
|
||||||
|
'menu1-2-1': 'Menu 1-2-1',
|
||||||
|
'menu1-2-2': 'Menu 1-2-2',
|
||||||
|
'menu1-3': 'Menu 1-3',
|
||||||
|
menu2: 'Menu 2',
|
||||||
Table: 'Table',
|
Table: 'Table',
|
||||||
dynamicTable: 'Dynamic Table',
|
dynamicTable: 'Dynamic Table',
|
||||||
dragTable: 'Drag Table',
|
dragTable: 'Drag Table',
|
||||||
|
|
|
@ -29,9 +29,13 @@ export default {
|
||||||
mixChart: '混合图表',
|
mixChart: '混合图表',
|
||||||
example: '综合实例',
|
example: '综合实例',
|
||||||
nested: '路由嵌套',
|
nested: '路由嵌套',
|
||||||
bar: 'Bar',
|
menu1: '菜单1',
|
||||||
barProfile: 'Profile',
|
'menu1-1': '菜单1-1',
|
||||||
barPosts: 'Posts',
|
'menu1-2': '菜单1-2',
|
||||||
|
'menu1-2-1': '菜单1-2-1',
|
||||||
|
'menu1-2-2': '菜单1-2-2',
|
||||||
|
'menu1-3': '菜单1-3',
|
||||||
|
menu2: '菜单2',
|
||||||
Table: 'Table',
|
Table: 'Table',
|
||||||
dynamicTable: '动态Table',
|
dynamicTable: '动态Table',
|
||||||
dragTable: '拖拽Table',
|
dragTable: '拖拽Table',
|
||||||
|
|
|
@ -202,7 +202,7 @@ export const asyncRouterMap = [
|
||||||
{
|
{
|
||||||
path: '/nested',
|
path: '/nested',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/nested/bar/profile',
|
redirect: '/nested/menu1',
|
||||||
name: 'nested',
|
name: 'nested',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'nested',
|
title: 'nested',
|
||||||
|
@ -210,24 +210,49 @@ export const asyncRouterMap = [
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/nested/bar', // Must write the full path
|
path: 'menu1',
|
||||||
component: () => import('@/views/nested/bar/index'), // Parent router-view
|
component: () => import('@/views/nested/menu1/index'), // Parent router-view
|
||||||
name: 'bar',
|
name: 'menu1',
|
||||||
meta: { title: 'bar' },
|
meta: { title: 'menu1' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'profile',
|
path: 'menu1-1',
|
||||||
component: () => import('@/views/nested/bar/profile'),
|
component: () => import('@/views/nested/menu1/menu1-1'),
|
||||||
name: 'bar-profile',
|
name: 'menu1-1',
|
||||||
meta: { title: 'barProfile' }
|
meta: { title: 'menu1-1' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'posts',
|
path: 'menu1-2',
|
||||||
component: () => import('@/views/nested/bar/posts'),
|
component: () => import('@/views/nested/menu1/menu1-2'),
|
||||||
name: 'bar-posts',
|
name: 'menu1-2',
|
||||||
meta: { title: 'barPosts' }
|
meta: { title: 'menu1-2' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'menu1-2-1',
|
||||||
|
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
|
||||||
|
name: 'menu1-2-1',
|
||||||
|
meta: { title: 'menu1-2-1' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'menu1-2-2',
|
||||||
|
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
|
||||||
|
name: 'menu1-2-2',
|
||||||
|
meta: { title: 'menu1-2-2' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'menu1-3',
|
||||||
|
component: () => import('@/views/nested/menu1/menu1-3'),
|
||||||
|
name: 'menu1-3',
|
||||||
|
meta: { title: 'menu1-3' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'menu2',
|
||||||
|
component: () => import('@/views/nested/menu2/index'),
|
||||||
|
meta: { title: 'menu2' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,26 +1,24 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="menu-wrapper">
|
<div v-if="!item.hidden&&item.children" class="menu-wrapper">
|
||||||
<template v-for="item in routes" v-if="!item.hidden&&item.children">
|
|
||||||
|
|
||||||
<router-link v-if="hasOneShowingChildren(item.children) && !item.children[0].children&&!item.alwaysShow" :to="item.path+'/'+item.children[0].path"
|
<router-link v-if="hasOneShowingChildren(item.children) && !item.children[0].children&&!item.alwaysShow" :to="resolvePath(item.children[0].path)">
|
||||||
:key="item.children[0].name">
|
<el-menu-item :index="resolvePath(item.children[0].path)" :class="{'submenu-title-noDropdown':!isNest}">
|
||||||
<el-menu-item :index="item.path+'/'+item.children[0].path" :class="{'submenu-title-noDropdown':!isNest}">
|
|
||||||
<svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon>
|
<svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon>
|
||||||
<span v-if="item.children[0].meta&&item.children[0].meta.title" slot="title">{{generateTitle(item.children[0].meta.title)}}</span>
|
<span v-if="item.children[0].meta&&item.children[0].meta.title" slot="title">{{generateTitle(item.children[0].meta.title)}}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
|
||||||
<el-submenu v-else :index="item.name||item.path" :key="item.name">
|
<el-submenu v-else :index="item.name||item.path">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<svg-icon v-if="item.meta&&item.meta.icon" :icon-class="item.meta.icon"></svg-icon>
|
<svg-icon v-if="item.meta&&item.meta.icon" :icon-class="item.meta.icon"></svg-icon>
|
||||||
<span v-if="item.meta&&item.meta.title" slot="title">{{generateTitle(item.meta.title)}}</span>
|
<span v-if="item.meta&&item.meta.title" slot="title">{{generateTitle(item.meta.title)}}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-for="child in item.children" v-if="!child.hidden">
|
<template v-for="child in item.children" v-if="!child.hidden">
|
||||||
<sidebar-item :is-nest="true" class="nest-menu" v-if="child.children&&child.children.length>0" :routes="[child]" :key="child.path"></sidebar-item>
|
<sidebar-item :is-nest="true" class="nest-menu" v-if="child.children&&child.children.length>0" :item="child" :key="child.path" :base-path="resolvePath(child.path)"></sidebar-item>
|
||||||
|
|
||||||
<router-link v-else :to="item.path+'/'+child.path" :key="child.name">
|
<router-link v-else :to="resolvePath(child.path)" :key="child.name">
|
||||||
<el-menu-item :index="item.path+'/'+child.path">
|
<el-menu-item :index="resolvePath(child.path)">
|
||||||
<svg-icon v-if="child.meta&&child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
|
<svg-icon v-if="child.meta&&child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
|
||||||
<span v-if="child.meta&&child.meta.title" slot="title">{{generateTitle(child.meta.title)}}</span>
|
<span v-if="child.meta&&child.meta.title" slot="title">{{generateTitle(child.meta.title)}}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
@ -28,22 +26,27 @@
|
||||||
</template>
|
</template>
|
||||||
</el-submenu>
|
</el-submenu>
|
||||||
|
|
||||||
</template>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import path from 'path'
|
||||||
import { generateTitle } from '@/utils/i18n'
|
import { generateTitle } from '@/utils/i18n'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SidebarItem',
|
name: 'SidebarItem',
|
||||||
props: {
|
props: {
|
||||||
routes: {
|
item: { // route配置json
|
||||||
type: Array
|
type: Object,
|
||||||
|
required: true
|
||||||
},
|
},
|
||||||
isNest: {
|
isNest: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
basePath: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -56,6 +59,9 @@ export default {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
resolvePath(...paths) {
|
||||||
|
return path.resolve(this.basePath, ...paths)
|
||||||
|
},
|
||||||
generateTitle
|
generateTitle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
text-color="#bfcbd9"
|
text-color="#bfcbd9"
|
||||||
active-text-color="#409EFF"
|
active-text-color="#409EFF"
|
||||||
>
|
>
|
||||||
<sidebar-item :routes="permission_routers"></sidebar-item>
|
<sidebar-item v-for="route in permission_routers" :key="route.name" :item="route" :base-path="route.path"></sidebar-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<code>Parent View: Bar</code>
|
|
||||||
<img src="https://wpimg.wallstcn.com/be29a7d2-5ccf-4a2b-888d-8a6c2bbb7aac.png">
|
|
||||||
<router-view></router-view>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<template>
|
|
||||||
<div style="margin-top:30px;">
|
|
||||||
<el-alert title="Children: Posts" type="warning" :closable="false">
|
|
||||||
</el-alert>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<template>
|
|
||||||
<div style="margin-top:30px;">
|
|
||||||
<el-alert title="Children: Profile" type="success" :closable="false">
|
|
||||||
</el-alert>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<template >
|
||||||
|
<div style="padding:30px;">
|
||||||
|
<el-alert title="menu 1" :closable="false">
|
||||||
|
<router-view />
|
||||||
|
</el-alert>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<template >
|
||||||
|
<div style="padding:30px;">
|
||||||
|
<el-alert title="menu 1-1" type="success" :closable="false">
|
||||||
|
<router-view />
|
||||||
|
</el-alert>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<template>
|
||||||
|
<div style="padding:30px;">
|
||||||
|
<el-alert title="menu 1-2" type="success" :closable="false">
|
||||||
|
<router-view />
|
||||||
|
</el-alert>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template functional>
|
||||||
|
<div style="padding:30px;">
|
||||||
|
<el-alert title="menu 1-2-1" type="warning" :closable="false" />
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template functional>
|
||||||
|
<div style="padding:30px;">
|
||||||
|
<el-alert title="menu 1-2-2" type="warning" :closable="false" />
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template functional>
|
||||||
|
<div style="padding:30px;">
|
||||||
|
<el-alert title="menu 1-3" type="success" :closable="false" />
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template>
|
||||||
|
<div style="padding:30px;">
|
||||||
|
<el-alert title="menu 2" :closable="false" />
|
||||||
|
</div>
|
||||||
|
</template>
|
Loading…
Reference in New Issue