Commit b79b109130442d3d4709157073b40f2f29136708
Merge branch 'ezTeach-2.0.0.0.release' of http://120.78.57.84/baoman/Ezquiz_Plat…
…form into ezTeach-2.0.0.0.release
Showing
2 changed files
with
23 additions
and
25 deletions
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
@@ -382,19 +382,18 @@ export default { | @@ -382,19 +382,18 @@ export default { | ||
382 | }, | 382 | }, |
383 | onIFrameLoad(id) { | 383 | onIFrameLoad(id) { |
384 | const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe | 384 | const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe |
385 | - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
386 | - // const body = iframeRef.contentWindow.document.body; | ||
387 | - // const height = body.scrollHeight; // 获取内容的高度 | ||
388 | - // console.log(height, "body高度"); | ||
389 | - // iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 | ||
390 | - // // 获取第一个P标签 | ||
391 | - // const firstP = doc.getElementsByTagName("p")[0]; | ||
392 | - // // 或者修改第一个 < p > 标签的内容; | ||
393 | - // if (firstP) { | ||
394 | - // console.log(firstP, firstP.innerHTML, "-----innerHTML-----"); | ||
395 | - // let a = this.processString(firstP.innerHTML); | ||
396 | - // firstP.innerHTML = a; | ||
397 | - // } | 385 | + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; |
386 | + const body = iframeRef.contentWindow.document.body; | ||
387 | + const height = body.scrollHeight; // 获取内容的高度 | ||
388 | + console.log(height, "body高度"); | ||
389 | + iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 | ||
390 | + // 获取第一个P标签 | ||
391 | + const firstP = doc.getElementsByTagName("p")[0]; | ||
392 | + // 或者修改第一个 < p > 标签的内容; | ||
393 | + if (firstP) { | ||
394 | + let a = this.processString(firstP.innerHTML); | ||
395 | + firstP.innerHTML = a; | ||
396 | + } | ||
398 | }, | 397 | }, |
399 | 398 | ||
400 | // 启动编辑模式 | 399 | // 启动编辑模式 |
src/views/basic/askTestQuestion/wrongQuestion.vue
@@ -567,18 +567,17 @@ export default { | @@ -567,18 +567,17 @@ export default { | ||
567 | // 获取ref | 567 | // 获取ref |
568 | onIFrameLoad(index) { | 568 | onIFrameLoad(index) { |
569 | const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe | 569 | const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe |
570 | - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | ||
571 | - // const body = iframeRef.contentWindow.document.body; | ||
572 | - // const height = body.scrollHeight; // 获取内容的高度 | ||
573 | - // iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 | ||
574 | - // // 获取第一个P标签 | ||
575 | - // const firstP = doc.getElementsByTagName("p")[0]; | ||
576 | - // // 或者修改第一个 < p > 标签的内容; | ||
577 | - // if (firstP) { | ||
578 | - // console.log(firstP, firstP.innerHTML, "-----innerHTML-----"); | ||
579 | - // let a = this.processString(firstP.innerHTML); | ||
580 | - // firstP.innerHTML = a; | ||
581 | - // } | 570 | + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; |
571 | + const body = iframeRef.contentWindow.document.body; | ||
572 | + const height = body.scrollHeight; // 获取内容的高度 | ||
573 | + iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 | ||
574 | + // 获取第一个P标签 | ||
575 | + const firstP = doc.getElementsByTagName("p")[0]; | ||
576 | + // 或者修改第一个 < p > 标签的内容; | ||
577 | + if (firstP) { | ||
578 | + let a = this.processString(firstP.innerHTML); | ||
579 | + firstP.innerHTML = a; | ||
580 | + } | ||
582 | }, | 581 | }, |
583 | 582 | ||
584 | // 子集删除后 父级需要更新 | 583 | // 子集删除后 父级需要更新 |