From 31636964ad61a43bb455351b0b896b54c3242299 Mon Sep 17 00:00:00 2001 From: Denny Date: Tue, 26 Sep 2023 03:00:36 +0000 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=8F=91=E5=B8=83=E5=90=8E?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E9=A1=B5=E9=9D=A2=E7=A9=BA=E7=99=BD=E6=8A=A5?= =?UTF-8?q?=E9=94=99:=20Cannot=20reading=20'addEventListener'=20of=20null?= =?UTF-8?q?=20=E8=A7=A3=E5=86=B3=E9=97=AE=E9=A2=98:=20=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=90=8E=E8=AE=BF=E9=97=AE=E9=A1=B5=E9=9D=A2=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E6=8A=A5=E9=94=99=EF=BC=9Ancaught=20(in=20promise)=20TypeError?= =?UTF-8?q?:=20Cannot=20read=20properties=20of=20null=20(reading=20'addEve?= =?UTF-8?q?ntListener')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Denny --- src/views/preview/wrapper.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/preview/wrapper.vue b/src/views/preview/wrapper.vue index 3ed56888..ef1d4ca3 100644 --- a/src/views/preview/wrapper.vue +++ b/src/views/preview/wrapper.vue @@ -15,7 +15,7 @@ let key = ref(Date.now()) // 数据变更 -> 组件销毁重建 ;[SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW].forEach((saveEvent: string) => { - if (!window.opener && !window.opener.addEventListener) return + if (!window.opener || !window.opener.addEventListener) return window.opener.addEventListener(saveEvent, async (e: any) => { const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }])