From ce1a5476d63fa2264b53bf0d22b9c073ef94eda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 16 Dec 2023 22:04:04 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E5=A2=9E=E5=BC=BA=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=81=A5=E5=A3=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/preview/wrapper.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/views/preview/wrapper.vue b/src/views/preview/wrapper.vue index ef1d4ca3..8bf03702 100644 --- a/src/views/preview/wrapper.vue +++ b/src/views/preview/wrapper.vue @@ -14,12 +14,17 @@ import Preview from './index.vue' let key = ref(Date.now()) // 数据变更 -> 组件销毁重建 -;[SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW].forEach((saveEvent: string) => { - 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 }]) - key.value = Date.now() +try { + const listenerArr = [SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW] + listenerArr.forEach((saveEvent: string) => { + 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 }]) + key.value = Date.now() + }) }) -}) +} catch (error) { + console.log(error) +}