iframe高度自适应
This commit is contained in:
parent
047ee8fae9
commit
8c3d227d02
|
|
@ -88,7 +88,6 @@ function Data(props){
|
|||
setSpining(false);
|
||||
}
|
||||
x.send();
|
||||
console.log("spining");
|
||||
}
|
||||
|
||||
function lookResult(taskId){
|
||||
|
|
@ -99,6 +98,19 @@ function Data(props){
|
|||
}
|
||||
}
|
||||
|
||||
function iframeLoad() {
|
||||
try {
|
||||
let myIframe = document.getElementById("htmlIframe");
|
||||
console.log('myIframe', myIframe, myIframe.contentDocument);
|
||||
if (myIframe.contentDocument) {
|
||||
console.log(myIframe.contentDocument.querySelector('.el-main'));
|
||||
myIframe.height = myIframe.contentDocument.querySelector('.el-main').clientHeight + 260;
|
||||
// myIframe.contentDocument.querySelector('.admin-body-container').style.overflow = 'hidden';
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
return(
|
||||
<div>
|
||||
<DetectionModal
|
||||
|
|
@ -175,7 +187,8 @@ function Data(props){
|
|||
</span>
|
||||
}
|
||||
</li>
|
||||
{openResultTaskId && openResultTaskId === e.task_id && <iframe title={`htmlIframe_${key}`} src={lookResultUrl+e.task_id} id={`htmlIframe_${key}`} frameBorder="0" name={`htmlIframe_${key}`} width="100%" height='500px'></iframe>}
|
||||
{/* lookResultUrl+e.task_id */}
|
||||
{openResultTaskId && openResultTaskId === e.task_id && <iframe title={`htmlIframe_${key}`} src={lookResultUrl+e.task_id} id={`htmlIframe`} frameBorder="0" name={`htmlIframe_${key}`} width="100%" onLoad={iframeLoad} height={'auto'}></iframe>}
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue