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

计算高度的bug

上级 63d087b7
...@@ -46,37 +46,26 @@ export default class Detail extends Component { ...@@ -46,37 +46,26 @@ export default class Detail extends Component {
} }
componentDidMount() { componentDidMount() {
// window.addEventListener( window.addEventListener(
// 'message', 'message',
// (event) => { (event) => {
// if (event.data && event.data.indexOf && event.data.indexOf('iframeDetailHeight') > -1) { if (event && event.data && event.data.indexOf && event.data.indexOf('iframeDetailHeight') > -1) {
// const height = Number(event.data.split('-')[1]); let height = Number(event.data.split('-')[1]);
// document.getElementById('detailIframeId').height = height; console.log(height);
// } const iframe = document.getElementById('applyIframeId');
// },
// false,
// );
}
// showAll = () => {
// this.setState({
// showAll: true,
// });
// };
setIframeHeight = () => {
let iframe = document.getElementById('applyIframeId');
if (iframe) { if (iframe) {
let iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; iframe.height = height;
if (iframeWin.document.body) {
iframe.style.height = (iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight) + 'px';
} }
} }
}; },
false,
);
}
render() { render() {
const { id } = this.state; const { id } = this.state;
let iframeUrl = `${config.gateWayPort}/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`; let iframeUrl = `${config.gateWayPort}/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`;
iframeUrl = `http://localhost:8022/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`;
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
<Shell> <Shell>
...@@ -84,16 +73,16 @@ export default class Detail extends Component { ...@@ -84,16 +73,16 @@ export default class Detail extends Component {
src={iframeUrl} src={iframeUrl}
frameBorder={0} frameBorder={0}
id="applyIframeId" id="applyIframeId"
onLoad={this.setIframeHeight}
name="applyIframe" name="applyIframe"
marginWidth="0" marginWidth="0"
marginHeight="0" marginHeight="0"
allowtransparency="yes" allowtransparency="yes"
seamless seamless
height={800}
scrolling={'no'} scrolling={'no'}
style={{ style={{
width: '100%', width: '100%',
height: '800px', // height: '800px',
overflowY: 'auto', overflowY: 'auto',
backgroundColor: '#fff', backgroundColor: '#fff',
}} }}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论