From e841ac77fd054a767c2bb5273ca704c8283481aa Mon Sep 17 00:00:00 2001 From: chenghongxing <1126263215@qq.com> Date: Sun, 8 Nov 2020 14:09:04 +0800 Subject: [PATCH] =?UTF-8?q?bug:=20fix=20the=20problem=20that=20page=20cont?= =?UTF-8?q?ent=20become=20blank=20when=20modifying=20the=20code;=20:bug:?= =?UTF-8?q?=20#141=20=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=97=B6=E9=A1=B5=E9=9D=A2=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=8F=98=E4=B8=BA=E7=A9=BA=E7=99=BD=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cache/AKeepAlive.js | 2 +- src/layouts/tabs/TabsView.vue | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/cache/AKeepAlive.js b/src/components/cache/AKeepAlive.js index 8c0eb8b..23f0031 100644 --- a/src/components/cache/AKeepAlive.js +++ b/src/components/cache/AKeepAlive.js @@ -127,7 +127,7 @@ export default { // same constructor may get registered as different local components // so cid alone is not enough (#3269) ? componentOptions.Ctor.cid + (componentOptions.tag ? `::${componentOptions.tag}` : '') - : vnode.key + : vnode.key + componentOptions.Ctor.cid if (cache[key]) { vnode.componentInstance = cache[key].componentInstance // make current key freshest diff --git a/src/layouts/tabs/TabsView.vue b/src/layouts/tabs/TabsView.vue index 96a6978..46d0430 100644 --- a/src/layouts/tabs/TabsView.vue +++ b/src/layouts/tabs/TabsView.vue @@ -261,7 +261,8 @@ export default { const page = this.pageList.find(item => item.fullPath === route.fullPath) page.unclose = route.meta && route.meta.page && (route.meta.page.closable === false) if (!page._init_) { - page.cachedKey = this.$refs.tabContent.$vnode.key + const vnode = this.$refs.tabContent.$vnode + page.cachedKey = vnode.key + vnode.componentOptions.Ctor.cid page._init_ = true } },