侧边栏修改

This commit is contained in:
妖姐 2024-04-08 19:39:25 +08:00
parent 1172832d9b
commit 4b1f6ea87a
5 changed files with 267 additions and 263 deletions

3
auto-imports.d.ts vendored
View File

@ -1,6 +1,5 @@
// Generated by 'unplugin-auto-import'
export {}
declare global {
const ElMessage: typeof import('element-plus/es')['ElMessage']
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
}

19
components.d.ts vendored
View File

@ -1,9 +1,9 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core';
import '@vue/runtime-core'
export {};
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
@ -18,8 +18,11 @@ declare module '@vue/runtime-core' {
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
@ -31,20 +34,19 @@ declare module '@vue/runtime-core' {
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElProgress: typeof import('element-plus/es')['ElProgress']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRate: typeof import('element-plus/es')['ElRate']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSlider: typeof import('element-plus/es')['ElSlider']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default']
GithubCorner: typeof import('./src/components/GithubCorner/index.vue')['default']
Hamburger: typeof import('./src/components/Hamburger/index.vue')['default']
@ -71,4 +73,7 @@ declare module '@vue/runtime-core' {
UploadExcel: typeof import('./src/components/UploadExcel/index.vue')['default']
VueCountTo: typeof import('./src/components/vue-count-to/vue-countTo.vue')['default']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}

View File

@ -3,7 +3,7 @@
<template
v-if="hasOneShowingChild(item.children, item) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !(item.meta && item.meta.alwaysShow)">
<app-link class="link" :to="resolvePath(onlyOneChild.path)">
<el-menu-item class="left-menu-item" v-if="onlyOneChild.meta" :index="resolvePath(onlyOneChild.path)"
<el-menu-item class="left-menu-item" v-if="onlyOneChild.meta" :index="resolvePath(onlyOneChild.path)"
:class="{ 'submenu-title-noDropdown': !isNest }">
<!-- <item :icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" :title="onlyOneChild.meta.title" /> -->

View File

@ -1,15 +1,15 @@
import { markRaw } from 'vue';
// import { markRaw } from 'vue';
import { createRouter, createWebHistory } from 'vue-router'; // createWebHashHistory, createWebHistory
import type { Router, RouteRecordRaw, RouteComponent } from 'vue-router';
import { Help as IconHelp } from '@element-plus/icons-vue';
// import { Help as IconHelp } from '@element-plus/icons-vue';
/* Layout */
const Layout = ():RouteComponent => import('@/layout/index.vue');
/* Router Modules */
import componentsRouter from './modules/components';
import chartsRouter from './modules/charts';
import nestedRouter from './modules/nested';
// import componentsRouter from './modules/components';
// import chartsRouter from './modules/charts';
// import nestedRouter from './modules/nested';
import tableRouter from './modules/table';
/**
@ -51,44 +51,44 @@ export const constantRoutes:RouteRecordRaw[] = [
component: () => import('@/views/error-page/401.vue'),
meta: { hidden: true }
},
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [
{
path: 'dashboard',
component: () => import('@/views/dashboard/index.vue'),
name: 'Dashboard',
meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
}
]
},
{
path: '/documentation',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/documentation/index.vue'),
name: 'Documentation',
meta: { title: 'Documentation', icon: 'documentation', affix: true }
}
]
},
{
path: '/guide',
component: Layout,
redirect: '/guide/index',
children: [
{
path: 'index',
component: () => import('@/views/guide/index.vue'),
name: 'Guide',
meta: { title: 'Guide', icon: 'guide', noCache: true }
}
]
},
// {
// path: '/',
// component: Layout,
// redirect: '/dashboard',
// children: [
// {
// path: 'dashboard',
// component: () => import('@/views/dashboard/index.vue'),
// name: 'Dashboard',
// meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
// }
// ]
// },
// {
// path: '/documentation',
// component: Layout,
// children: [
// {
// path: 'index',
// component: () => import('@/views/documentation/index.vue'),
// name: 'Documentation',
// meta: { title: 'Documentation', icon: 'documentation', affix: true }
// }
// ]
// },
// {
// path: '/guide',
// component: Layout,
// redirect: '/guide/index',
// children: [
// {
// path: 'index',
// component: () => import('@/views/guide/index.vue'),
// name: 'Guide',
// meta: { title: 'Guide', icon: 'guide', noCache: true }
// }
// ]
// },
{
path: '/profile',
component: Layout,
@ -118,91 +118,91 @@ export const asyncRoutes:RouteRecordRaw[] = [
redirect: '/permission/page',
name: 'Permission',
meta: {
alwaysShow: true, // will always show the root menu
title: 'Permission',
icon: 'lock',
roles: ['admin', 'editor'] // you can set roles in root nav
// alwaysShow: true, // will always show the root menu
title: '内部系统'
// icon: 'lock'
// roles: ['admin', 'editor'] // you can set roles in root nav
},
children: [
{
path: 'page',
component: () => import('@/views/permission/page.vue'),
name: 'PagePermission',
meta: {
title: 'Page Permission',
roles: ['admin'] // or you can only set roles in sub nav
}
},
{
path: 'directive',
component: () => import('@/views/permission/directive.vue'),
name: 'DirectivePermission',
meta: {
title: 'Directive Permission'
// if do not set roles, means: this page does not require permission
}
},
{
path: 'role',
component: () => import('@/views/permission/role.vue'),
name: 'RolePermission',
meta: {
title: 'Role Permission',
roles: ['admin']
}
}
// {
// path: 'page',
// component: () => import('@/views/permission/page.vue'),
// name: 'PagePermission',
// meta: {
// title: 'Page Permission',
// roles: ['admin'] // or you can only set roles in sub nav
// }
// },
// {
// path: 'directive',
// component: () => import('@/views/permission/directive.vue'),
// name: 'DirectivePermission',
// meta: {
// title: 'Directive Permission'
// // if do not set roles, means: this page does not require permission
// }
// },
// {
// path: 'role',
// component: () => import('@/views/permission/role.vue'),
// name: 'RolePermission',
// meta: {
// title: 'Role Permission',
// roles: ['admin']
// }
// }
]
},
{
path: '/icon',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/icons/index.vue'),
name: 'Icons',
meta: { title: 'Icons', icon: 'icon', noCache: true }
}
]
},
// {
// path: '/icon',
// component: Layout,
// children: [
// {
// path: 'index',
// component: () => import('@/views/icons/index.vue'),
// name: 'Icons',
// meta: { title: 'Icons', icon: 'icon', noCache: true }
// }
// ]
// },
// /** when your routing map is too long, you can split it into small modules **/
componentsRouter,
chartsRouter,
nestedRouter,
// componentsRouter,
// chartsRouter,
// nestedRouter,
tableRouter,
{
path: '/example',
component: Layout,
redirect: '/example/list',
name: 'Example',
meta: {
title: 'Example',
icon: markRaw(IconHelp)
},
children: [
{
path: 'create',
component: () => import('@/views/example/create.vue'),
name: 'CreateArticle',
meta: { title: 'Create Article', icon: 'edit' }
},
{
path: 'edit/:id(\\d+)',
component: () => import('@/views/example/edit.vue'),
name: 'EditArticle',
meta: { hidden: true, title: 'Edit Article', noCache: true, activeMenu: '/example/list' }
},
{
path: 'list',
component: () => import('@/views/example/list.vue'),
name: 'ArticleList',
meta: { title: 'Article List', icon: 'list' }
}
]
},
//
// {
// path: '/example',
// component: Layout,
// redirect: '/example/list',
// name: 'Example',
// meta: {
// title: 'Example',
// icon: markRaw(IconHelp)
// },
// children: [
// {
// path: 'create',
// component: () => import('@/views/example/create.vue'),
// name: 'CreateArticle',
// meta: { title: 'Create Article', icon: 'edit' }
// },
// {
// path: 'edit/:id(\\d+)',
// component: () => import('@/views/example/edit.vue'),
// name: 'EditArticle',
// meta: { hidden: true, title: 'Edit Article', noCache: true, activeMenu: '/example/list' }
// },
// {
// path: 'list',
// component: () => import('@/views/example/list.vue'),
// name: 'ArticleList',
// meta: { title: 'Article List', icon: 'list' }
// }
// ]
// },
{
path: '/tab',
@ -212,35 +212,35 @@ export const asyncRoutes:RouteRecordRaw[] = [
path: 'index',
component: () => import('@/views/tab/index.vue'),
name: 'Tab',
meta: { title: 'Tab', icon: 'tab' }
meta: { title: '日报', icon: 'tab' }
}
]
},
{
path: '/error',
component: Layout,
redirect: 'noRedirect',
name: 'ErrorPages',
meta: {
title: 'Error Pages',
icon: '404'
},
children: [
{
path: '401',
component: () => import('@/views/error-page/401.vue'),
name: 'Page401',
meta: { title: '401', noCache: true }
},
{
path: '404',
component: () => import('@/views/error-page/404.vue'),
name: 'Page404',
meta: { title: '404', noCache: true }
}
]
},
// {
// path: '/error',
// component: Layout,
// redirect: 'noRedirect',
// name: 'ErrorPages',
// meta: {
// title: 'Error Pages',
// icon: '404'
// },
// children: [
// {
// path: '401',
// component: () => import('@/views/error-page/401.vue'),
// name: 'Page401',
// meta: { title: '401', noCache: true }
// },
// {
// path: '404',
// component: () => import('@/views/error-page/404.vue'),
// name: 'Page404',
// meta: { title: '404', noCache: true }
// }
// ]
// },
{
path: '/error-log',
@ -250,7 +250,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
path: 'log',
component: () => import('@/views/error-log/index.vue'),
name: 'ErrorLog',
meta: { title: 'Error Log', icon: 'bug' }
meta: { title: '消息', icon: 'bug' }
}
]
},
@ -261,7 +261,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
redirect: '/excel/export-excel',
name: 'Excel',
meta: {
title: 'Excel',
title: '申请和审批',
icon: 'excel'
},
children: [
@ -269,63 +269,63 @@ export const asyncRoutes:RouteRecordRaw[] = [
path: 'export-excel',
component: () => import('@/views/excel/export-excel.vue'),
name: 'ExportExcel',
meta: { title: 'Export Excel' }
meta: { title: '提交申请' }
},
{
path: 'export-selected-excel',
component: () => import('@/views/excel/select-excel.vue'),
name: 'SelectExcel',
meta: { title: 'Export Selected' }
meta: { title: '我的审批' }
},
{
path: 'export-merge-header',
component: () => import('@/views/excel/merge-header.vue'),
name: 'MergeHeader',
meta: { title: 'Merge Header' }
},
{
path: 'upload-excel',
component: () => import('@/views/excel/upload-excel.vue'),
name: 'UploadExcel',
meta: { title: 'Upload Excel' }
meta: { title: '记录查询' }
}
// {
// path: 'upload-excel',
// component: () => import('@/views/excel/upload-excel.vue'),
// name: 'UploadExcel',
// meta: { title: 'Upload Excel' }
// }
]
},
{
path: '/zip',
component: Layout,
redirect: '/zip/download',
name: 'Zip',
meta: { alwaysShow: true, title: 'Zip', icon: 'zip' },
children: [
{
path: 'download',
component: () => import('@/views/zip/index.vue'),
name: 'ExportZip',
meta: { title: 'Export Zip' }
}
]
},
// {
// path: '/zip',
// component: Layout,
// redirect: '/zip/download',
// name: 'Zip',
// meta: { alwaysShow: true, title: 'Zip', icon: 'zip' },
// children: [
// {
// path: 'download',
// component: () => import('@/views/zip/index.vue'),
// name: 'ExportZip',
// meta: { title: 'Export Zip' }
// }
// ]
// },
{
path: '/pdf',
component: Layout,
redirect: '/pdf/index',
children: [
{
path: 'index',
component: () => import('@/views/pdf/index.vue'),
name: 'PDF',
meta: { title: 'PDF', icon: 'pdf' }
}
]
},
{
path: '/pdf/download',
component: () => import('@/views/pdf/download.vue'),
meta: { hidden: true }
},
// {
// path: '/pdf',
// component: Layout,
// redirect: '/pdf/index',
// children: [
// {
// path: 'index',
// component: () => import('@/views/pdf/index.vue'),
// name: 'PDF',
// meta: { title: 'PDF', icon: 'pdf' }
// }
// ]
// },
// {
// path: '/pdf/download',
// component: () => import('@/views/pdf/download.vue'),
// meta: { hidden: true }
// },
{
path: '/theme',
@ -335,65 +335,65 @@ export const asyncRoutes:RouteRecordRaw[] = [
path: 'index',
component: () => import('@/views/theme/index.vue'),
name: 'Theme',
meta: { title: 'Theme', icon: 'theme' }
meta: { title: '个人信息管理', icon: 'theme' }
}
]
},
{
path: '/clipboard',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/clipboard/index.vue'),
name: 'ClipboardDemo',
meta: { title: 'Clipboard', icon: 'clipboard' }
}
]
},
// {
// path: '/clipboard',
// component: Layout,
// children: [
// {
// path: 'index',
// component: () => import('@/views/clipboard/index.vue'),
// name: 'ClipboardDemo',
// meta: { title: 'Clipboard', icon: 'clipboard' }
// }
// ]
// },
{
path: '/external-link',
component: Layout,
children: [
{
path: 'https://element-plus.midfar.com',
meta: { title: 'External Link', icon: 'link' },
redirect: ''
}
]
},
{
path: '/my-demo',
component: Layout,
name: 'MyDemo',
meta: {
title: 'MyDemo',
icon: 'component'
},
children: [
{
path: 'element-demo',
component: () => import('@/views/mydemo/ElementDemo.vue'),
name: 'ElementDemo',
meta: { title: 'ElementDemo', icon: 'skill' }
},
{
path: 'store-demo',
component: () => import('@/views/mydemo/StoreDemo.vue'),
name: 'StoreDemo',
meta: { title: 'StoreDemo', icon: 'lock' }
},
{
path: 'webSocket-demo',
component: () => import('@/views/mydemo/WebSocketDemo.vue'),
name: 'WebSocketDemo',
meta: { title: 'WebSocketDemo', icon: 'lock' }
}
]
},
// {
// path: '/external-link',
// component: Layout,
// children: [
// {
// path: 'https://element-plus.midfar.com',
// meta: { title: 'External Link', icon: 'link' },
// redirect: ''
// }
// ]
// },
//
// {
// path: '/my-demo',
// component: Layout,
// name: 'MyDemo',
// meta: {
// title: 'MyDemo',
// icon: 'component'
// },
// children: [
// {
// path: 'element-demo',
// component: () => import('@/views/mydemo/ElementDemo.vue'),
// name: 'ElementDemo',
// meta: { title: 'ElementDemo', icon: 'skill' }
// },
// {
// path: 'store-demo',
// component: () => import('@/views/mydemo/StoreDemo.vue'),
// name: 'StoreDemo',
// meta: { title: 'StoreDemo', icon: 'lock' }
// },
// {
// path: 'webSocket-demo',
// component: () => import('@/views/mydemo/WebSocketDemo.vue'),
// name: 'WebSocketDemo',
// meta: { title: 'WebSocketDemo', icon: 'lock' }
// }
// ]
// },
// 404 page must be placed at the end !!!
{ path: '/:pathMatch(.*)*', redirect: '/404', meta: { hidden: true }}

View File

@ -8,7 +8,7 @@ const tableRouter = {
redirect: '/table/complex-table',
name: 'Table',
meta: {
title: 'Table',
title: '个人项目',
icon: 'table'
},
children: [
@ -16,25 +16,25 @@ const tableRouter = {
path: 'dynamic-table',
component: () => import('@/views/table/dynamic-table/index.vue'),
name: 'DynamicTable',
meta: { title: 'Dynamic Table' }
meta: { title: '我参与的' }
},
{
path: 'drag-table',
component: () => import('@/views/table/drag-table.vue'),
name: 'DragTable',
meta: { title: 'Drag Table' }
},
{
path: 'inline-edit-table',
component: () => import('@/views/table/inline-edit-table.vue'),
name: 'InlineEditTable',
meta: { title: 'Inline Edit' }
meta: { title: '我管理的' }
},
// {
// path: 'inline-edit-table',
// component: () => import('@/views/table/inline-edit-table.vue'),
// name: 'InlineEditTable',
// meta: { title: 'Inline Edit' }
// },
{
path: 'complex-table',
component: () => import('@/views/table/complex-table.vue'),
name: 'ComplexTable',
meta: { title: 'Complex Table' }
meta: { title: '我负责的' }
}
]
};