From 38004755e3f0cefb1fa08927414d9dee6c9e74e5 Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Wed, 4 Nov 2020 14:54:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=86=E9=A2=91=E6=95=99?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/sidebar-videos.svg | 1 + src/layout/components/SearchSidebar/index.vue | 2 +- src/layout/index.vue | 1 - src/router/index.js | 10 ++ src/router/modules/videos.example.js | 109 ++++++++++++++++++ src/store/modules/global.js | 2 +- src/views/videos_example/1.vue | 23 ++++ src/views/videos_example/2.vue | 23 ++++ src/views/videos_example/3.vue | 23 ++++ src/views/videos_example/4.vue | 23 ++++ src/views/videos_example/5.vue | 23 ++++ 11 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 src/assets/icons/sidebar-videos.svg create mode 100644 src/router/modules/videos.example.js create mode 100644 src/views/videos_example/1.vue create mode 100644 src/views/videos_example/2.vue create mode 100644 src/views/videos_example/3.vue create mode 100644 src/views/videos_example/4.vue create mode 100644 src/views/videos_example/5.vue diff --git a/src/assets/icons/sidebar-videos.svg b/src/assets/icons/sidebar-videos.svg new file mode 100644 index 00000000..6a82de1d --- /dev/null +++ b/src/assets/icons/sidebar-videos.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/layout/components/SearchSidebar/index.vue b/src/layout/components/SearchSidebar/index.vue index e26533ee..966ded3d 100644 --- a/src/layout/components/SearchSidebar/index.vue +++ b/src/layout/components/SearchSidebar/index.vue @@ -9,7 +9,7 @@
- +
diff --git a/src/layout/index.vue b/src/layout/index.vue index d867d608..19d1dff9 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -326,7 +326,6 @@ header { .el-menu { border-right: 0; padding-top: $g-breadcrumb-height; - padding-bottom: 30px; &:not(.el-menu--collapse) { width: inherit; } diff --git a/src/router/index.js b/src/router/index.js index 4fce2c44..c77b2dc5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -72,6 +72,7 @@ import BreadcrumbExample from './modules/breadcrumb.example' import KeepAliveExample from './modules/keep.alive.example' import ComponentExample from './modules/component.example' import PermissionExample from './modules/permission.example' +import VideosExample from './modules/videos.example' import ExTernalLinkExample from './modules/external.link.example' // 当 children 不为空的主导航只有一项时,则隐藏 @@ -89,6 +90,15 @@ let asyncRoutes = [ PermissionExample ] }, + { + meta: { + title: '教程', + icon: 'sidebar-videos' + }, + children: [ + ...VideosExample + ] + }, { meta: { title: '其它', diff --git a/src/router/modules/videos.example.js b/src/router/modules/videos.example.js new file mode 100644 index 00000000..12faa59e --- /dev/null +++ b/src/router/modules/videos.example.js @@ -0,0 +1,109 @@ +import Layout from '@/layout' + +export default [ + { + path: '/videos_example/1', + component: Layout, + name: 'videosExample1', + meta: { + title: '01 - 开发环境配置' + }, + children: [ + { + path: '', + name: 'videosExampleVideo1', + component: () => import(/* webpackChunkName: 'videos_example' */ '@/views/videos_example/1'), + meta: { + title: '01 - 开发环境配置', + sidebar: false, + breadcrumb: false, + activeMenu: '/videos_example/1' + } + } + ] + }, + { + path: '/videos_example/2', + component: Layout, + name: 'videosExample2', + meta: { + title: '02 - 框架配置' + }, + children: [ + { + path: '', + name: 'videosExampleVideo2', + component: () => import(/* webpackChunkName: 'videos_example' */ '@/views/videos_example/2'), + meta: { + title: '02 框架配置', + sidebar: false, + breadcrumb: false, + activeMenu: '/videos_example/2' + } + } + ] + }, + { + path: '/videos_example/3', + component: Layout, + name: 'videosExample3', + meta: { + title: '03 - 布局和主题' + }, + children: [ + { + path: '', + name: 'videosExampleVideo3', + component: () => import(/* webpackChunkName: 'videos_example' */ '@/views/videos_example/3'), + meta: { + title: '03 布局和主题', + sidebar: false, + breadcrumb: false, + activeMenu: '/videos_example/3' + } + } + ] + }, + { + path: '/videos_example/4', + component: Layout, + name: 'videosExample4', + meta: { + title: '04 - 全局资源' + }, + children: [ + { + path: '', + name: 'videosExampleVideo4', + component: () => import(/* webpackChunkName: 'videos_example' */ '@/views/videos_example/4'), + meta: { + title: '04 全局资源', + sidebar: false, + breadcrumb: false, + activeMenu: '/videos_example/4' + } + } + ] + }, + { + path: '/videos_example/5', + component: Layout, + name: 'videosExample5', + meta: { + title: '05 - 组件' + }, + children: [ + { + path: '', + name: 'videosExampleVideo5', + component: () => import(/* webpackChunkName: 'videos_example' */ '@/views/videos_example/5'), + meta: { + title: '05 组件', + sidebar: false, + breadcrumb: false, + activeMenu: '/videos_example/5' + } + } + ] + } +] diff --git a/src/store/modules/global.js b/src/store/modules/global.js index ace5b197..aaaf719e 100644 --- a/src/store/modules/global.js +++ b/src/store/modules/global.js @@ -129,7 +129,7 @@ const mutations = { }, setHeaderActive(state, currentPath) { state.allRoutes.map((item, index) => { - if (item.children.some(r => currentPath.indexOf(r.path + '/') === 0)) { + if (item.children.some(r => currentPath.indexOf(r.path + '/') === 0 || currentPath == r.path)) { state.headerNavActive = index } }) diff --git a/src/views/videos_example/1.vue b/src/views/videos_example/1.vue new file mode 100644 index 00000000..cfb09447 --- /dev/null +++ b/src/views/videos_example/1.vue @@ -0,0 +1,23 @@ +