Commit 8266ec666c5cccd6e9623928eea4fcc2bcd61517
1 parent
78d84757
wip: bug修复
Showing
1 changed file
with
17 additions
and
17 deletions
src/views/basic/askTestQuestion/wrongQuestion.vue
| ... | ... | @@ -658,23 +658,23 @@ export default { |
| 658 | 658 | // let a = this.processString(firstP.innerHTML); |
| 659 | 659 | // firstP.innerHTML = a; |
| 660 | 660 | // } |
| 661 | - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | |
| 662 | - // const body = iframeRef.contentWindow.document.body; | |
| 663 | - // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | |
| 664 | - // const height = body.offsetHeight; // 获取内容的高度 | |
| 665 | - // console.log(height, "height"); | |
| 666 | - // // console.log("body.offsetHeight:", body.offsetHeight); | |
| 667 | - // // console.log("body.clientHeight:", body.clientHeight); | |
| 668 | - // // console.log("body.scrollHeight:", body.scrollHeight); | |
| 669 | - | |
| 670 | - // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | |
| 671 | - // // 获取第一个P标签 | |
| 672 | - // const firstP = doc.getElementsByTagName("p")[0]; | |
| 673 | - // // 或者修改第一个 < p > 标签的内容; | |
| 674 | - // if (firstP) { | |
| 675 | - // let a = this.processString(firstP.innerHTML); | |
| 676 | - // firstP.innerHTML = a; | |
| 677 | - // } | |
| 661 | + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | |
| 662 | + const body = iframeRef.contentWindow.document.body; | |
| 663 | + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | |
| 664 | + const height = body.offsetHeight; // 获取内容的高度 | |
| 665 | + console.log(height, "height"); | |
| 666 | + // console.log("body.offsetHeight:", body.offsetHeight); | |
| 667 | + // console.log("body.clientHeight:", body.clientHeight); | |
| 668 | + // console.log("body.scrollHeight:", body.scrollHeight); | |
| 669 | + | |
| 670 | + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | |
| 671 | + // 获取第一个P标签 | |
| 672 | + const firstP = doc.getElementsByTagName("p")[0]; | |
| 673 | + // 或者修改第一个 < p > 标签的内容; | |
| 674 | + if (firstP) { | |
| 675 | + let a = this.processString(firstP.innerHTML); | |
| 676 | + firstP.innerHTML = a; | |
| 677 | + } | |
| 678 | 678 | }, |
| 679 | 679 | |
| 680 | 680 | // 子集删除后 父级需要更新 | ... | ... |