diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue
index 99790cc..9768348 100644
--- a/src/components/CommandRunResult.vue
+++ b/src/components/CommandRunResult.vue
@@ -18,11 +18,13 @@
@@ -30,11 +32,13 @@
@@ -60,7 +64,9 @@ export default {
history: [],
historyIdx: null,
enableHtml: false,
- child: null,
+ frameInitHeight: 0,
+ childProcess: null,
+ timeStamp: null,
};
},
props: {
@@ -124,7 +130,7 @@ export default {
: this.$root.programs[currentCommand.program];
option.scptarg = currentCommand.scptarg || "";
option.charset = currentCommand.charset || {};
- this.child = window.runCodeFile(
+ this.childProcess = window.runCodeFile(
currentCommand.cmd,
option,
currentCommand.output === "terminal",
@@ -210,6 +216,7 @@ export default {
// 显示运行结果
showRunResult(content, isSuccess, action) {
this.isResultShow = true;
+ this.timeStamp = new Date().getTime();
this.runResultStatus = isSuccess;
let contlength = content?.length || 0;
if (contlength > this.resultMaxLength)
@@ -251,12 +258,16 @@ export default {
if (!!this.quickcommandListener) {
document.removeEventListener("keydown", this.quickcommandListener);
}
- if (!!this.child) {
- quickcommand.kill(this.child.pid);
+ if (!!this.childProcess) {
+ quickcommand.kill(this.childProcess.pid);
}
quickcommand.closeWaitBtn?.();
quickcommand.closeWaitBtn = () => {};
},
+ frameLoad(initHeight) {
+ this.outputAutoHeight(this.fromUtools);
+ this.frameInitHeight = initHeight;
+ },
},
unmounted() {
this.stopRun();
diff --git a/src/components/ResultArea.vue b/src/components/ResultArea.vue
index 50a1fd9..94c7024 100644
--- a/src/components/ResultArea.vue
+++ b/src/components/ResultArea.vue
@@ -40,7 +40,6 @@ const frameStyle = `
@@ -48,13 +47,14 @@ body {
export default {
data() {
- return { frameStyle: frameStyle, frameHeight: 0 };
+ return { frameStyle: frameStyle, frameHeight: this.frameInitHeight };
},
props: {
enableHtml: Boolean,
runResultStatus: Boolean,
runResult: String,
maxHeight: Number,
+ frameInitHeight: Number,
},
computed: {
cfw() {
@@ -64,15 +64,25 @@ export default {
return this.enableHtml && this.runResultStatus;
},
},
+ mounted() {
+ this.frameInit();
+ },
methods: {
- frameLoad() {
- this.cfw.quickcommand = _.cloneDeep(quickcommand);
- this.cfw.utools = _.cloneDeep(utools);
- this.frameHeight = Math.min(
- this.cfw.document.documentElement.getBoundingClientRect().height,
- this.maxHeight
- );
- this.$emit("frameLoad");
+ frameInit() {
+ if (!this.cfw) return;
+ let ctx = {
+ quickcommand: _.cloneDeep(quickcommand),
+ utools: _.cloneDeep(utools),
+ parent: undefined,
+ };
+ Object.assign(this.cfw, ctx);
+ this.cfw.onload = () => {
+ this.frameHeight = Math.min(
+ this.cfw.document.documentElement.getBoundingClientRect().height,
+ this.maxHeight
+ );
+ this.$emit("frameLoad", this.frameHeight);
+ };
},
},
};