1)不跨域 直接获取到iframe中的内容
定时器设置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); };