提交 103bbdea authored 作者: 钟是志's avatar 钟是志

IframeFor2.0

上级 5ab79fc0
...@@ -58,14 +58,24 @@ export default class Detail extends Component { ...@@ -58,14 +58,24 @@ export default class Detail extends Component {
// ); // );
} }
showAll = () => { // showAll = () => {
this.setState({ // this.setState({
showAll: true, // showAll: true,
}); // });
}; // };
setIframeHeight = () => {
let iframe = document.getElementById('applyIframeId');
if (iframe) {
let iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
if (iframeWin.document.body) {
iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
}
}
};
render() { render() {
const { id, showAll } = this.state; const { id } = this.state;
const iframeUrl = `${config.gateWayPort}/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`; const iframeUrl = `${config.gateWayPort}/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`;
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
...@@ -73,18 +83,19 @@ export default class Detail extends Component { ...@@ -73,18 +83,19 @@ export default class Detail extends Component {
<iframe <iframe
src={iframeUrl} src={iframeUrl}
frameBorder={0} frameBorder={0}
id="detailIframeId" id="applyIframeId"
name="applyIframe" onLoad={this.setIframeHeight}
name="applyIframe"
marginWidth="0" marginWidth="0"
marginHeight="0" marginHeight="0"
onLoad={this.showAll}
allowtransparency="yes" allowtransparency="yes"
seamless seamless
scrolling={'no'} scrolling={'no'}
style={{ style={{
width: '100%', width: '100%',
overflowY: 'hidden', height: '800px',
minHeight: '900px', overflowY: 'auto',
backgroundColor: '#fff',
}} }}
/> />
</Shell> </Shell>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论