From 1e50cb07aea54eb14ba590527c99d71fe9cb6b6a Mon Sep 17 00:00:00 2001 From: fofolee Date: Thu, 28 Apr 2022 20:21:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=BB=9A=E5=8A=A8=E5=92=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandRunResult.vue | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue index 169deab..6937292 100644 --- a/src/components/CommandRunResult.vue +++ b/src/components/CommandRunResult.vue @@ -16,10 +16,7 @@ > - +
- +
@@ -46,7 +43,7 @@ :key="timeStamp" /> - + @@ -237,18 +234,23 @@ export default { this.runResultStatus = isSuccess; if (!_.isArray(content)) content = [content]; this.runResult = this.runResult.concat(content); + this.autoScroll(); }, // 根据输出自动滚动及调整 utools 高度 - outputAutoHeight(e) { - let autoScroll = 1; + autoHeight(e) { + if (!this.fromUtools) return; let pluginHeight = e.height < this.maxHeight ? e.height : this.maxHeight; - this.fromUtools && utools.setExpendHeight(pluginHeight); - autoScroll && - window.scroll({ - top: e.height, - left: 0, + utools.setExpendHeight(pluginHeight); + }, + autoScroll() { + if (this.enableHtml) return; + this.$nextTick(() => { + let results = document.querySelectorAll(".result"); + results[results.length - 1].scrollIntoView({ + block: "end", behavior: "smooth", }); + }); }, stopRun() { this.runResult = [];