mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
iframe 问题修复
This commit is contained in:
parent
30d0c33dcc
commit
e8821c3d5f
@ -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>;
|
||||
|
Loading…
Reference in New Issue
Block a user