Commit 147b8d92b153cc6062838f604ac3010850ac280e
1 parent
e7f7bfce
feat: 代码提交
Showing
2 changed files
with
31 additions
and
31 deletions
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
| @@ -429,20 +429,20 @@ export default { | @@ -429,20 +429,20 @@ export default { | ||
| 429 | }, | 429 | }, |
| 430 | onIFrameLoad(id) { | 430 | onIFrameLoad(id) { |
| 431 | const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe | 431 | const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe |
| 432 | - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
| 433 | - // const body = iframeRef.contentWindow.document.body; | ||
| 434 | - // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 435 | - // const height = body.offsetHeight; // 获取内容的高度 | ||
| 436 | - // console.log(height, "height"); | ||
| 437 | - // console.log(body, "body"); | ||
| 438 | - // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 439 | - // // 获取第一个P标签 | ||
| 440 | - // const firstP = doc.getElementsByTagName("p")[0]; | ||
| 441 | - // // 或者修改第一个 < p > 标签的内容; | ||
| 442 | - // if (firstP) { | ||
| 443 | - // let a = this.processString(firstP.innerHTML); | ||
| 444 | - // firstP.innerHTML = a; | ||
| 445 | - // } | 432 | + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; |
| 433 | + const body = iframeRef.contentWindow.document.body; | ||
| 434 | + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 435 | + const height = body.offsetHeight; // 获取内容的高度 | ||
| 436 | + console.log(height, "height"); | ||
| 437 | + console.log(body, "body"); | ||
| 438 | + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 439 | + // 获取第一个P标签 | ||
| 440 | + const firstP = doc.getElementsByTagName("p")[0]; | ||
| 441 | + // 或者修改第一个 < p > 标签的内容; | ||
| 442 | + if (firstP) { | ||
| 443 | + let a = this.processString(firstP.innerHTML); | ||
| 444 | + firstP.innerHTML = a; | ||
| 445 | + } | ||
| 446 | }, | 446 | }, |
| 447 | 447 | ||
| 448 | // 启动编辑模式 | 448 | // 启动编辑模式 |
src/views/basic/askTestQuestion/wrongQuestion.vue
| @@ -657,23 +657,23 @@ export default { | @@ -657,23 +657,23 @@ export default { | ||
| 657 | // let a = this.processString(firstP.innerHTML); | 657 | // let a = this.processString(firstP.innerHTML); |
| 658 | // firstP.innerHTML = a; | 658 | // firstP.innerHTML = a; |
| 659 | // } | 659 | // } |
| 660 | - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
| 661 | - // const body = iframeRef.contentWindow.document.body; | ||
| 662 | - // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 663 | - // const height = body.offsetHeight; // 获取内容的高度 | ||
| 664 | - // console.log(height, "height"); | ||
| 665 | - // // console.log("body.offsetHeight:", body.offsetHeight); | ||
| 666 | - // // console.log("body.clientHeight:", body.clientHeight); | ||
| 667 | - // // console.log("body.scrollHeight:", body.scrollHeight); | ||
| 668 | - | ||
| 669 | - // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 670 | - // // 获取第一个P标签 | ||
| 671 | - // const firstP = doc.getElementsByTagName("p")[0]; | ||
| 672 | - // // 或者修改第一个 < p > 标签的内容; | ||
| 673 | - // if (firstP) { | ||
| 674 | - // let a = this.processString(firstP.innerHTML); | ||
| 675 | - // firstP.innerHTML = a; | ||
| 676 | - // } | 660 | + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; |
| 661 | + const body = iframeRef.contentWindow.document.body; | ||
| 662 | + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 663 | + const height = body.offsetHeight; // 获取内容的高度 | ||
| 664 | + console.log(height, "height"); | ||
| 665 | + // console.log("body.offsetHeight:", body.offsetHeight); | ||
| 666 | + // console.log("body.clientHeight:", body.clientHeight); | ||
| 667 | + // console.log("body.scrollHeight:", body.scrollHeight); | ||
| 668 | + | ||
| 669 | + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 670 | + // 获取第一个P标签 | ||
| 671 | + const firstP = doc.getElementsByTagName("p")[0]; | ||
| 672 | + // 或者修改第一个 < p > 标签的内容; | ||
| 673 | + if (firstP) { | ||
| 674 | + let a = this.processString(firstP.innerHTML); | ||
| 675 | + firstP.innerHTML = a; | ||
| 676 | + } | ||
| 677 | }, | 677 | }, |
| 678 | 678 | ||
| 679 | // 子集删除后 父级需要更新 | 679 | // 子集删除后 父级需要更新 |