From e8821c3d5f434aeb022d8fb9d6ab0b5c99be34c9 Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Thu, 10 Dec 2020 19:17:30 +0800 Subject: [PATCH] =?UTF-8?q?iframe=20=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/IFrame.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderers/IFrame.tsx b/src/renderers/IFrame.tsx index 47c9acd1d..8d3d8aa0f 100644 --- a/src/renderers/IFrame.tsx +++ b/src/renderers/IFrame.tsx @@ -135,7 +135,7 @@ export default class IFrame extends React.Component { @autobind postMessage(type: string, data: any) { - (this.IFrameRef.current as HTMLIFrameElement).contentWindow?.postMessage( + (this.IFrameRef.current as HTMLIFrameElement)?.contentWindow?.postMessage( { type: `amis:${type}`, data @@ -162,6 +162,7 @@ export default class IFrame extends React.Component { if ( typeof finalSrc === 'string' && + finalSrc && !/^(\.\/|\.\.\/|\/|https?\:\/\/|https?\%3A\%2F\%2F)/.test(finalSrc) ) { return

请填写合法的 iframe 地址

;