feat: 调整一级菜单

This commit is contained in:
fit2cloud-chenyw 2021-04-22 17:59:16 +08:00
parent ef5eab2e19
commit d28a69e056
5 changed files with 22 additions and 14 deletions

View File

@ -3,7 +3,7 @@
<transition-group name="breadcrumb"> <transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path"> <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
<span v-if="index === 0">当前位置</span> <span v-if="index === 0">当前位置</span>
<span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{item.meta.title }}</span> <span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
<a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a> <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>
@ -34,7 +34,7 @@ export default {
const first = matched[0] const first = matched[0]
if (!this.isDashboard(first)) { if (!this.isDashboard(first)) {
matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched) matched = [{ path: '/panel', meta: { title: '仪表板' }}].concat(matched)
} }
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
@ -44,7 +44,8 @@ export default {
if (!name) { if (!name) {
return false return false
} }
return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase() // return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase()
return name.trim().toLocaleLowerCase() === '仪表板'.toLocaleLowerCase()
}, },
pathCompile(path) { pathCompile(path) {
// To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561

View File

@ -56,6 +56,7 @@ import { post } from '@/api/panel/panel'
import bus from '@/utils/bus' import bus from '@/utils/bus'
export default { export default {
// eslint-disable-next-line vue/no-unused-components
components: { PreviewEject }, components: { PreviewEject },
data() { data() {
return { return {

View File

@ -94,7 +94,7 @@ export default {
return meta.activeMenu return meta.activeMenu
} }
// //
if (path === '/dashboard') { if (path === '/panel') {
return '/' return '/'
} }
// //

View File

@ -82,19 +82,25 @@ export const constantRoutes = [
component: () => import('@/components/canvas/components/Editor/PreviewFullScreen'), component: () => import('@/components/canvas/components/Editor/PreviewFullScreen'),
hidden: true hidden: true
}, },
{ {
path: '/', path: '/',
component: Layout, component: Layout,
redirect: '/dashboard', redirect: '/panel',
children: [{ hidden: true
path: 'dashboard',
name: 'Dashboard',
component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard' }
}]
} }
// {
// path: '/',
// component: Layout,
// redirect: '/panel',
// children: [{
// path: 'index',
// name: '仪表板',
// component: () => import('@/views/panel/index'),
// meta: { title: '仪表板', icon: 'dashboard' }
// }]
// }
// { // {
// path: '/example', // path: '/example',
// component: Layout, // component: Layout,

View File

@ -13,7 +13,7 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li>或者你可以去:</li> <li>或者你可以去:</li>
<li class="link-type"> <li class="link-type">
<router-link to="/dashboard"> <router-link to="/panel">
回首页 回首页
</router-link> </router-link>
</li> </li>
@ -39,7 +39,7 @@ export default {
methods: { methods: {
back() { back() {
if (this.$route.query.noGoBack) { if (this.$route.query.noGoBack) {
this.$router.push({ path: '/dashboard' }) this.$router.push({ path: '/panel' })
} else { } else {
this.$router.go(-1) this.$router.go(-1)
} }