refactor: adjust routes

This commit is contained in:
张传龙 2022-08-08 15:36:43 +08:00
parent ef3aaa5be5
commit 0bb2a904e7
7 changed files with 19 additions and 16 deletions

View File

@ -1,6 +1,10 @@
<template> <template>
<n-breadcrumb> <n-breadcrumb>
<n-breadcrumb-item v-for="item in route.matched" :key="item.path" @click="handleBreadClick(item.path)"> <n-breadcrumb-item
v-for="item in route.matched.filter((item) => !!item.meta?.title)"
:key="item.path"
@click="handleBreadClick(item.path)"
>
<component :is="renderIcon(item.meta?.icon, { size: 16 })" v-if="item.meta?.icon" /> <component :is="renderIcon(item.meta?.icon, { size: 16 })" v-if="item.meta?.icon" />
{{ item.meta.title }} {{ item.meta.title }}
</n-breadcrumb-item> </n-breadcrumb-item>

View File

@ -9,7 +9,7 @@ export const basicRoutes = [
}, },
{ {
name: 'LOGIN', name: 'Login',
path: '/login', path: '/login',
component: () => import('@/views/login/index.vue'), component: () => import('@/views/login/index.vue'),
isHidden: true, isHidden: true,
@ -25,7 +25,7 @@ export const basicRoutes = [
meta: { meta: {
title: '外部链接', title: '外部链接',
icon: 'mdi:link-variant', icon: 'mdi:link-variant',
index: 1, index: 2,
}, },
children: [ children: [
{ {

View File

@ -8,7 +8,7 @@ export default {
meta: { meta: {
title: '错误页', title: '错误页',
icon: 'mdi:alert-circle-outline', icon: 'mdi:alert-circle-outline',
index: 4, index: 99,
}, },
children: [ children: [
{ {

View File

@ -10,6 +10,7 @@ export default {
icon: 'mdi:menu', icon: 'mdi:menu',
role: ['admin'], role: ['admin'],
requireAuth: true, requireAuth: true,
index: 3,
}, },
children: [ children: [
{ {

View File

@ -8,12 +8,13 @@ export default {
meta: { meta: {
title: '基础功能测试', title: '基础功能测试',
icon: 'mdi:menu', icon: 'mdi:menu',
index: 1,
}, },
children: [ children: [
{ {
name: 'Unocss', name: 'Unocss',
path: 'unocss', path: 'unocss',
component: () => import('@/views/test-page/unocss/index.vue'), component: () => import('./unocss/index.vue'),
meta: { meta: {
title: '测试unocss', title: '测试unocss',
}, },
@ -21,7 +22,7 @@ export default {
{ {
name: 'Message', name: 'Message',
path: 'message', path: 'message',
component: () => import('@/views/test-page/message/index.vue'), component: () => import('./message/index.vue'),
meta: { meta: {
title: '测试Message', title: '测试Message',
}, },
@ -29,7 +30,7 @@ export default {
{ {
name: 'Dialog', name: 'Dialog',
path: 'dialog', path: 'dialog',
component: () => import('@/views/test-page/dialog/index.vue'), component: () => import('./dialog/index.vue'),
meta: { meta: {
title: '测试Dialog', title: '测试Dialog',
}, },
@ -37,7 +38,7 @@ export default {
{ {
name: 'TestKeepAlive', name: 'TestKeepAlive',
path: 'keep-alive', path: 'keep-alive',
component: () => import('@/views/test-page/keep-alive/index.vue'), component: () => import('./keep-alive/index.vue'),
meta: { meta: {
title: '测试Keep-Alive', title: '测试Keep-Alive',
keepAlive: true, keepAlive: true,

View File

@ -4,19 +4,16 @@ export default {
name: 'Dashboard', name: 'Dashboard',
path: '/', path: '/',
component: Layout, component: Layout,
redirect: '/home', redirect: '/workbench',
meta: {
title: 'Dashboard',
icon: 'mdi:chart-bar',
},
children: [ children: [
{ {
name: 'Home', name: 'Workbench',
path: 'home', path: 'workbench',
component: () => import('./index.vue'), component: () => import('./index.vue'),
meta: { meta: {
title: '首页', title: '工作台',
icon: 'mdi:home', icon: 'mdi:home',
index: 0,
}, },
}, },
], ],