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 = [];