From 147b8d92b153cc6062838f604ac3010850ac280e Mon Sep 17 00:00:00 2001 From: 刘有才luck <14606842+liu-youcai-luck@user.noreply.gitee.com> Date: Fri, 6 Dec 2024 15:12:34 +0800 Subject: [PATCH] feat: 代码提交 --- src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue | 28 ++++++++++++++-------------- src/views/basic/askTestQuestion/wrongQuestion.vue | 34 +++++++++++++++++----------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue index 6ea3314..8b5e99d 100644 --- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue +++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue @@ -429,20 +429,20 @@ export default { }, onIFrameLoad(id) { const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; - // const body = iframeRef.contentWindow.document.body; - // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 - // const height = body.offsetHeight; // 获取内容的高度 - // console.log(height, "height"); - // console.log(body, "body"); - // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 - // // 获取第一个P标签 - // const firstP = doc.getElementsByTagName("p")[0]; - // // 或者修改第一个 < p > 标签的内容; - // if (firstP) { - // let a = this.processString(firstP.innerHTML); - // firstP.innerHTML = a; - // } + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; + const body = iframeRef.contentWindow.document.body; + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 + const height = body.offsetHeight; // 获取内容的高度 + console.log(height, "height"); + console.log(body, "body"); + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 + // 获取第一个P标签 + const firstP = doc.getElementsByTagName("p")[0]; + // 或者修改第一个 < p > 标签的内容; + if (firstP) { + let a = this.processString(firstP.innerHTML); + firstP.innerHTML = a; + } }, // 启动编辑模式 diff --git a/src/views/basic/askTestQuestion/wrongQuestion.vue b/src/views/basic/askTestQuestion/wrongQuestion.vue index f3ec342..bd7203f 100644 --- a/src/views/basic/askTestQuestion/wrongQuestion.vue +++ b/src/views/basic/askTestQuestion/wrongQuestion.vue @@ -657,23 +657,23 @@ export default { // let a = this.processString(firstP.innerHTML); // firstP.innerHTML = a; // } - // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; - // const body = iframeRef.contentWindow.document.body; - // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 - // const height = body.offsetHeight; // 获取内容的高度 - // console.log(height, "height"); - // // console.log("body.offsetHeight:", body.offsetHeight); - // // console.log("body.clientHeight:", body.clientHeight); - // // console.log("body.scrollHeight:", body.scrollHeight); - - // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 - // // 获取第一个P标签 - // const firstP = doc.getElementsByTagName("p")[0]; - // // 或者修改第一个 < p > 标签的内容; - // if (firstP) { - // let a = this.processString(firstP.innerHTML); - // firstP.innerHTML = a; - // } + const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; + const body = iframeRef.contentWindow.document.body; + body.style.overflowX = "hidden"; // 不允许出现横向滚动条 + const height = body.offsetHeight; // 获取内容的高度 + console.log(height, "height"); + // console.log("body.offsetHeight:", body.offsetHeight); + // console.log("body.clientHeight:", body.clientHeight); + // console.log("body.scrollHeight:", body.scrollHeight); + + iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 + // 获取第一个P标签 + const firstP = doc.getElementsByTagName("p")[0]; + // 或者修改第一个 < p > 标签的内容; + if (firstP) { + let a = this.processString(firstP.innerHTML); + firstP.innerHTML = a; + } }, // 子集删除后 父级需要更新 -- libgit2 0.21.4