From 8d89e205271625339fb44f5747608bcab3fcc72e Mon Sep 17 00:00:00 2001 From: xiaodi Date: Sun, 31 May 2020 22:17:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 16 +++--------- src/components/TabBar.vue | 37 ++++++++++++++++----------- src/config/router.config.js | 31 ++++++++++++++--------- src/layouts/TabBarLayout.vue | 48 ++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 38 deletions(-) create mode 100644 src/layouts/TabBarLayout.vue diff --git a/src/App.vue b/src/App.vue index 20397b6..0178e00 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,21 +1,11 @@ diff --git a/src/components/TabBar.vue b/src/components/TabBar.vue index b04388c..631e926 100644 --- a/src/components/TabBar.vue +++ b/src/components/TabBar.vue @@ -1,28 +1,37 @@ diff --git a/src/config/router.config.js b/src/config/router.config.js index add8534..1d926b7 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -6,19 +6,28 @@ export const constantRouterMap = [ { path: '/', name: 'index', - component: () => import('@/views/home/index'), // 路由懒加载 + component: () => import('@/layouts/TabBarLayout'), // 路由懒加载 + redirect: '/home', meta: { title: '首页', // 页面标题 keepAlive: false // keep-alive 标识 - } - }, - { - path: '/about', - name: 'about', - component: () => import('@/views/home/about'), - meta: { - title: '关于我', - keepAlive: false - } + }, + children: [ + { + path: '/home', + name: 'Home', + component: () => import('@/views/home/index'), + meta: { title: '首页', keepAlive: false } + }, + { + path: '/about', + name: 'About', + component: () => import('@/views/home/about'), + meta: { + title: '关于我', + keepAlive: false + } + } + ] } ] diff --git a/src/layouts/TabBarLayout.vue b/src/layouts/TabBarLayout.vue new file mode 100644 index 0000000..26f82a9 --- /dev/null +++ b/src/layouts/TabBarLayout.vue @@ -0,0 +1,48 @@ + + +