定时器设置iframe高度
changeIframeHeight = () => {
const reinitIframe = () => {
let count = 0;
return () => {
try {
const height = this.iframe.contentWindow.document.querySelector('.ant-table-body').offsetHeight + 5
this.iframe.height = height > 150 ? height : 150;
count += 1
} catch (ex) {
console.log('ex: ', ex);
}
return count
};
}
let resetCount = 0
const reset = reinitIframe()
const timer = setInterval(() => {
if (resetCount > 15) {
clearInterval(timer)
}
resetCount = reset()
}, 300);
};
原文:https://www.cnblogs.com/coldfrost/p/11731584.html