第三方应用open预览地址的时候,发现window.opener并不是一个window对象会报addEventListener不存在。

第三方应用open预览地址的时候,发现window.opener并不是一个window对象会报addEventListener不存在。

Signed-off-by: 空 <jinj@hxcfsoft.com>
This commit is contained in:
2023-09-15 14:12:28 +00:00 committed by Gitee
parent 87aa938e60
commit 52aeca9dd4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -16,6 +16,7 @@ let key = ref(Date.now())
// ->
;[SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW].forEach((saveEvent: string) => {
if (!window.opener) return
if(!(window.opener === window)) 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 }])