From e441e8060f6d59371a706e525567a70ef4ebc934 Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Fri, 15 Oct 2021 13:55:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=90=8E=E7=BD=AE?= =?UTF-8?q?=E9=92=A9=E5=AD=90=E9=87=8C=E4=BB=A3=E7=A0=81=E7=B2=BE=E7=AE=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 7827b000..e96f46ce 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -192,11 +192,7 @@ router.afterEach((to, from) => { if (to.meta.cache) { let componentName = to.matched[to.matched.length - 1].components.default.name if (componentName) { - to.matched.forEach(item => { - if (item.components.default.name && item.components.default.name != 'Layout') { - store.commit('keepAlive/add', item.components.default.name) - } - }) + store.commit('keepAlive/add', componentName) } else { console.warn('该页面组件未设置组件名,会导致缓存失效,请检查') } From bfe07463150d9ec1ded2bb76a77396319e1fdf2a Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Fri, 15 Oct 2021 17:39:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=BA=E4=BE=A7=E8=BE=B9=E6=A0=8F=E6=A8=A1=E5=BC=8F=EF=BC=88?= =?UTF-8?q?=E4=B8=8D=E5=90=AB=E4=B8=BB=E5=AF=BC=E8=88=AA=EF=BC=89=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E5=9C=A8=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E4=B8=8B=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/MainSidebar/index.vue | 2 +- src/layout/components/SubSidebar/index.vue | 6 +++--- src/layout/index.vue | 15 +++++++++++++-- src/store/modules/menu.js | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/layout/components/MainSidebar/index.vue b/src/layout/components/MainSidebar/index.vue index 492bccb6..4bf59003 100644 --- a/src/layout/components/MainSidebar/index.vue +++ b/src/layout/components/MainSidebar/index.vue @@ -1,6 +1,6 @@