diff --git a/src/layout/components/Sidebar/Item.vue b/src/layout/components/Sidebar/Item.vue index b515f61..aa1f5da 100644 --- a/src/layout/components/Sidebar/Item.vue +++ b/src/layout/components/Sidebar/Item.vue @@ -17,7 +17,11 @@ export default { const vnodes = [] if (icon) { - vnodes.push() + if (icon.includes('el-icon')) { + vnodes.push() + } else { + vnodes.push() + } } if (title) { @@ -27,3 +31,11 @@ export default { } } + + diff --git a/src/router/index.js b/src/router/index.js index f091f0f..d7177f8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -19,7 +19,7 @@ import Layout from '@/layout' * meta : { roles: ['admin','editor'] control the page roles (you can set multiple roles) title: 'title' the name show in sidebar and breadcrumb (recommend set) - icon: 'svg-name' the icon show in the sidebar + icon: 'svg-name'/'el-icon-x' the icon show in the sidebar breadcrumb: false if set false, the item will hidden in breadcrumb(default is true) activeMenu: '/example/list' if set path, the sidebar will highlight the path you set } @@ -60,7 +60,7 @@ export const constantRoutes = [ component: Layout, redirect: '/example/table', name: 'Example', - meta: { title: 'Example', icon: 'example' }, + meta: { title: 'Example', icon: 'el-icon-s-help' }, children: [ { path: 'table', diff --git a/src/styles/sidebar.scss b/src/styles/sidebar.scss index 3dad4c3..94760cc 100644 --- a/src/styles/sidebar.scss +++ b/src/styles/sidebar.scss @@ -57,6 +57,11 @@ margin-right: 16px; } + .sub-el-icon { + margin-right: 12px; + margin-left: -2px; + } + .el-menu { border: none; height: 100%; @@ -105,6 +110,10 @@ .svg-icon { margin-left: 20px; } + + .sub-el-icon { + margin-left: 19px; + } } } @@ -118,6 +127,10 @@ margin-left: 20px; } + .sub-el-icon { + margin-left: 19px; + } + .el-submenu__icon-arrow { display: none; } @@ -178,6 +191,10 @@ .svg-icon { margin-right: 16px; } + .sub-el-icon { + margin-right: 12px; + margin-left: -2px; + } } .nest-menu .el-submenu>.el-submenu__title,