mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
commit
dabe43331d
@ -157,6 +157,16 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
||||
...tempStyle,
|
||||
...style
|
||||
};
|
||||
|
||||
const finalSrc = src ? buildApi(src, data).url : undefined;
|
||||
|
||||
if (
|
||||
typeof finalSrc === 'string' &&
|
||||
!/^(\.\/|\.\.\/|\/|https?\:\/\/)/.test(finalSrc)
|
||||
) {
|
||||
return <p>请填写合法的 iframe 地址</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<iframe
|
||||
className={className}
|
||||
@ -164,7 +174,7 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
||||
style={style}
|
||||
ref={this.IFrameRef}
|
||||
onLoad={this.onLoad}
|
||||
src={src ? buildApi(src, data).url : undefined}
|
||||
src={finalSrc}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user