From f5e2c11387d21fba5202207cc6db6d562c5ccbee Mon Sep 17 00:00:00 2001 From: change chou Date: Wed, 26 Apr 2023 13:42:01 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(TabsView):=20=E5=88=A4?= =?UTF-8?q?=E6=96=ADpage=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -当被刷新标签页未被打开时,进行刷新标签操作page报错,故新增判断 --- src/layouts/tabs/TabsView.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/layouts/tabs/TabsView.vue b/src/layouts/tabs/TabsView.vue index bfafac2c..ea904f3c 100644 --- a/src/layouts/tabs/TabsView.vue +++ b/src/layouts/tabs/TabsView.vue @@ -136,13 +136,15 @@ export default { }, refresh (key, page) { page = page || this.pageList.find(item => item.path === key) - page.loading = true - this.clearCache(page) - if (key === this.activePage) { - this.reloadContent(() => page.loading = false) - } else { - // 其实刷新很快,加这个延迟纯粹为了 loading 状态多展示一会儿,让用户感知刷新这一过程 - setTimeout(() => page.loading = false, 500) + if(page){ + page.loading = true + this.clearCache(page) + if (key === this.activePage) { + this.reloadContent(() => page.loading = false) + } else { + // 其实刷新很快,加这个延迟纯粹为了 loading 状态多展示一会儿,让用户感知刷新这一过程 + setTimeout(() => page.loading = false, 500) + } } }, onContextmenu(pageKey, e) {