mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-07-27 14:07:24 +08:00
输出更新后强制刷新 frame
This commit is contained in:
parent
0be0c8dd88
commit
6301ad1b6b
@ -18,11 +18,13 @@
|
|||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
<ResultArea
|
<ResultArea
|
||||||
v-if="isResultShow"
|
v-if="isResultShow"
|
||||||
@frameLoad="outputAutoHeight(fromUtools)"
|
@frameLoad="frameLoad"
|
||||||
|
:frameInitHeight="frameInitHeight"
|
||||||
:enableHtml="enableHtml"
|
:enableHtml="enableHtml"
|
||||||
:runResultStatus="runResultStatus"
|
:runResultStatus="runResultStatus"
|
||||||
:runResult="runResult"
|
:runResult="runResult"
|
||||||
:maxHeight="maxHeight"
|
:maxHeight="maxHeight"
|
||||||
|
:key="timeStamp"
|
||||||
/>
|
/>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
@ -30,11 +32,13 @@
|
|||||||
<div v-else>
|
<div v-else>
|
||||||
<ResultArea
|
<ResultArea
|
||||||
v-if="isResultShow"
|
v-if="isResultShow"
|
||||||
@frameLoad="outputAutoHeight(fromUtools)"
|
@frameLoad="frameLoad"
|
||||||
|
:frameInitHeight="frameInitHeight"
|
||||||
:enableHtml="enableHtml"
|
:enableHtml="enableHtml"
|
||||||
:runResultStatus="runResultStatus"
|
:runResultStatus="runResultStatus"
|
||||||
:runResult="runResult"
|
:runResult="runResult"
|
||||||
:maxHeight="maxHeight"
|
:maxHeight="maxHeight"
|
||||||
|
:key="timeStamp"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -60,7 +64,9 @@ export default {
|
|||||||
history: [],
|
history: [],
|
||||||
historyIdx: null,
|
historyIdx: null,
|
||||||
enableHtml: false,
|
enableHtml: false,
|
||||||
child: null,
|
frameInitHeight: 0,
|
||||||
|
childProcess: null,
|
||||||
|
timeStamp: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -124,7 +130,7 @@ export default {
|
|||||||
: this.$root.programs[currentCommand.program];
|
: this.$root.programs[currentCommand.program];
|
||||||
option.scptarg = currentCommand.scptarg || "";
|
option.scptarg = currentCommand.scptarg || "";
|
||||||
option.charset = currentCommand.charset || {};
|
option.charset = currentCommand.charset || {};
|
||||||
this.child = window.runCodeFile(
|
this.childProcess = window.runCodeFile(
|
||||||
currentCommand.cmd,
|
currentCommand.cmd,
|
||||||
option,
|
option,
|
||||||
currentCommand.output === "terminal",
|
currentCommand.output === "terminal",
|
||||||
@ -210,6 +216,7 @@ export default {
|
|||||||
// 显示运行结果
|
// 显示运行结果
|
||||||
showRunResult(content, isSuccess, action) {
|
showRunResult(content, isSuccess, action) {
|
||||||
this.isResultShow = true;
|
this.isResultShow = true;
|
||||||
|
this.timeStamp = new Date().getTime();
|
||||||
this.runResultStatus = isSuccess;
|
this.runResultStatus = isSuccess;
|
||||||
let contlength = content?.length || 0;
|
let contlength = content?.length || 0;
|
||||||
if (contlength > this.resultMaxLength)
|
if (contlength > this.resultMaxLength)
|
||||||
@ -251,12 +258,16 @@ export default {
|
|||||||
if (!!this.quickcommandListener) {
|
if (!!this.quickcommandListener) {
|
||||||
document.removeEventListener("keydown", this.quickcommandListener);
|
document.removeEventListener("keydown", this.quickcommandListener);
|
||||||
}
|
}
|
||||||
if (!!this.child) {
|
if (!!this.childProcess) {
|
||||||
quickcommand.kill(this.child.pid);
|
quickcommand.kill(this.childProcess.pid);
|
||||||
}
|
}
|
||||||
quickcommand.closeWaitBtn?.();
|
quickcommand.closeWaitBtn?.();
|
||||||
quickcommand.closeWaitBtn = () => {};
|
quickcommand.closeWaitBtn = () => {};
|
||||||
},
|
},
|
||||||
|
frameLoad(initHeight) {
|
||||||
|
this.outputAutoHeight(this.fromUtools);
|
||||||
|
this.frameInitHeight = initHeight;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
this.stopRun();
|
this.stopRun();
|
||||||
|
@ -40,7 +40,6 @@ const frameStyle = `<style>::-webkit-scrollbar {
|
|||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 10px 20px;
|
|
||||||
color: ${utools.isDarkColors() ? "white" : "unset"}
|
color: ${utools.isDarkColors() ? "white" : "unset"}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -48,13 +47,14 @@ body {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return { frameStyle: frameStyle, frameHeight: 0 };
|
return { frameStyle: frameStyle, frameHeight: this.frameInitHeight };
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
enableHtml: Boolean,
|
enableHtml: Boolean,
|
||||||
runResultStatus: Boolean,
|
runResultStatus: Boolean,
|
||||||
runResult: String,
|
runResult: String,
|
||||||
maxHeight: Number,
|
maxHeight: Number,
|
||||||
|
frameInitHeight: Number,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cfw() {
|
cfw() {
|
||||||
@ -64,15 +64,25 @@ export default {
|
|||||||
return this.enableHtml && this.runResultStatus;
|
return this.enableHtml && this.runResultStatus;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.frameInit();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
frameLoad() {
|
frameInit() {
|
||||||
this.cfw.quickcommand = _.cloneDeep(quickcommand);
|
if (!this.cfw) return;
|
||||||
this.cfw.utools = _.cloneDeep(utools);
|
let ctx = {
|
||||||
this.frameHeight = Math.min(
|
quickcommand: _.cloneDeep(quickcommand),
|
||||||
this.cfw.document.documentElement.getBoundingClientRect().height,
|
utools: _.cloneDeep(utools),
|
||||||
this.maxHeight
|
parent: undefined,
|
||||||
);
|
};
|
||||||
this.$emit("frameLoad");
|
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);
|
||||||
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user