Commit 7feaa4bf4ed2732a3a60fea06e4dc79ed64f474f
1 parent
ab5562a5
feat: 代码提交
Showing
2 changed files
with
29 additions
and
29 deletions
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
| @@ -431,19 +431,19 @@ export default { | @@ -431,19 +431,19 @@ export default { | ||
| 431 | })); | 431 | })); |
| 432 | }, | 432 | }, |
| 433 | onIFrameLoad(id) { | 433 | onIFrameLoad(id) { |
| 434 | - // const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe | ||
| 435 | - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
| 436 | - // const body = iframeRef.contentWindow.document.body; | ||
| 437 | - // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 438 | - // const height = body.offsetHeight; // 获取内容的高度 | ||
| 439 | - // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 440 | - // // 获取第一个P标签 | ||
| 441 | - // const firstP = doc.getElementsByTagName("p")[0]; | ||
| 442 | - // // 或者修改第一个 < p > 标签的内容; | ||
| 443 | - // if (firstP) { | ||
| 444 | - // let a = this.processString(firstP.innerHTML); | ||
| 445 | - // firstP.innerHTML = a; | ||
| 446 | - // } | 434 | + const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe |
| 435 | + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
| 436 | + const body = iframeRef.contentWindow.document.body; | ||
| 437 | + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 438 | + const height = body.offsetHeight; // 获取内容的高度 | ||
| 439 | + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 440 | + // 获取第一个P标签 | ||
| 441 | + const firstP = doc.getElementsByTagName("p")[0]; | ||
| 442 | + // 或者修改第一个 < p > 标签的内容; | ||
| 443 | + if (firstP) { | ||
| 444 | + let a = this.processString(firstP.innerHTML); | ||
| 445 | + firstP.innerHTML = a; | ||
| 446 | + } | ||
| 447 | }, | 447 | }, |
| 448 | 448 | ||
| 449 | // 启动编辑模式 | 449 | // 启动编辑模式 |
src/views/basic/askTestQuestion/wrongQuestion.vue
| @@ -625,22 +625,22 @@ export default { | @@ -625,22 +625,22 @@ export default { | ||
| 625 | 625 | ||
| 626 | // 获取ref | 626 | // 获取ref |
| 627 | onIFrameLoad(index) { | 627 | onIFrameLoad(index) { |
| 628 | - // const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe | ||
| 629 | - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
| 630 | - // const body = iframeRef.contentWindow.document.body; | ||
| 631 | - // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 632 | - // const height = body.offsetHeight; // 获取内容的高度 | ||
| 633 | - // // console.log("body.offsetHeight:", body.offsetHeight); | ||
| 634 | - // // console.log("body.clientHeight:", body.clientHeight); | ||
| 635 | - // // console.log("body.scrollHeight:", body.scrollHeight); | ||
| 636 | - // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 637 | - // // 获取第一个P标签 | ||
| 638 | - // const firstP = doc.getElementsByTagName("p")[0]; | ||
| 639 | - // // 或者修改第一个 < p > 标签的内容; | ||
| 640 | - // if (firstP) { | ||
| 641 | - // let a = this.processString(firstP.innerHTML); | ||
| 642 | - // firstP.innerHTML = a; | ||
| 643 | - // } | 628 | + const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe |
| 629 | + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
| 630 | + const body = iframeRef.contentWindow.document.body; | ||
| 631 | + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | ||
| 632 | + const height = body.offsetHeight; // 获取内容的高度 | ||
| 633 | + // console.log("body.offsetHeight:", body.offsetHeight); | ||
| 634 | + // console.log("body.clientHeight:", body.clientHeight); | ||
| 635 | + // console.log("body.scrollHeight:", body.scrollHeight); | ||
| 636 | + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 | ||
| 637 | + // 获取第一个P标签 | ||
| 638 | + const firstP = doc.getElementsByTagName("p")[0]; | ||
| 639 | + // 或者修改第一个 < p > 标签的内容; | ||
| 640 | + if (firstP) { | ||
| 641 | + let a = this.processString(firstP.innerHTML); | ||
| 642 | + firstP.innerHTML = a; | ||
| 643 | + } | ||
| 644 | }, | 644 | }, |
| 645 | 645 | ||
| 646 | // 子集删除后 父级需要更新 | 646 | // 子集删除后 父级需要更新 |