mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +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
|
@autobind
|
||||||
postMessage(type: string, data: any) {
|
postMessage(type: string, data: any) {
|
||||||
(this.IFrameRef.current as HTMLIFrameElement).contentWindow?.postMessage(
|
(this.IFrameRef.current as HTMLIFrameElement)?.contentWindow?.postMessage(
|
||||||
{
|
{
|
||||||
type: `amis:${type}`,
|
type: `amis:${type}`,
|
||||||
data
|
data
|
||||||
@ -162,6 +162,7 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
typeof finalSrc === 'string' &&
|
typeof finalSrc === 'string' &&
|
||||||
|
finalSrc &&
|
||||||
!/^(\.\/|\.\.\/|\/|https?\:\/\/|https?\%3A\%2F\%2F)/.test(finalSrc)
|
!/^(\.\/|\.\.\/|\/|https?\:\/\/|https?\%3A\%2F\%2F)/.test(finalSrc)
|
||||||
) {
|
) {
|
||||||
return <p>请填写合法的 iframe 地址</p>;
|
return <p>请填写合法的 iframe 地址</p>;
|
||||||
|
Loading…
Reference in New Issue
Block a user