From eb969def191295e1c8c7ea7b1b7dea0262af05bb Mon Sep 17 00:00:00 2001 From: zhaoguoqiang <849348323@qq.com> Date: Wed, 1 Sep 2021 14:58:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=B8=8AkeepAlive,=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 20 +-- src/router/index.js | 9 +- src/views/PerformanceData/index.vue | 21 ++- src/views/cityDistribution/index.vue | 69 ++++--- src/views/dataOverview/index.vue | 27 ++- src/views/teamList/index.vue | 2 +- src/views/teamPerformance/index.vue | 257 +++++++++++++++------------ 7 files changed, 240 insertions(+), 165 deletions(-) diff --git a/src/App.vue b/src/App.vue index a612a21..d4e84ac 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,8 +1,9 @@ @@ -10,24 +11,11 @@ export default { name:'APP', - provide(){ //父组件中通过provide来提供变量,在子组件中通过inject来注入变量。 - return{ - reload:this.reload - } - }, data(){ return{ - isRouterAlive:true + } }, - methods: { - reload () { - this.isRouterAlive = false; //先关闭, - this.$nextTick(function () { - this.isRouterAlive = true; //再打开 - }) - } - } }; diff --git a/src/router/index.js b/src/router/index.js index 1fa032a..c3c40c4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -31,6 +31,9 @@ const routes = [{ path: "/home", name: 'home', component: () => import('../views/Home/index.vue'), + meta: { + keepAlive: true + } }, { path: "/cityDistribution", @@ -51,14 +54,14 @@ const routes = [{ path: "/teamList", name: 'teamList', component: () => import('../views/teamList/index.vue'), - meta: { - // title: '列表' - } }, { path: "/teamPerformance", name: 'teamPerformance', component: () => import('../views/teamPerformance/index.vue'), + meta: { + keepAlive: true + } }, ]; diff --git a/src/views/PerformanceData/index.vue b/src/views/PerformanceData/index.vue index c9f592f..52b81e9 100644 --- a/src/views/PerformanceData/index.vue +++ b/src/views/PerformanceData/index.vue @@ -1,7 +1,8 @@