iframe 问题修复

This commit is contained in:
2betop 2020-12-10 19:17:30 +08:00
parent 30d0c33dcc
commit e8821c3d5f

View File

@ -135,7 +135,7 @@ export default class IFrame extends React.Component<IFrameProps, object> {
@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<IFrameProps, object> {
if (
typeof finalSrc === 'string' &&
finalSrc &&
!/^(\.\/|\.\.\/|\/|https?\:\/\/|https?\%3A\%2F\%2F)/.test(finalSrc)
) {
return <p> iframe </p>;