mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-07-25 21:11:06 +08:00
输出更新后强制刷新 frame
This commit is contained in:
parent
0be0c8dd88
commit
6301ad1b6b
@ -18,11 +18,13 @@
|
||||
</q-toolbar>
|
||||
<ResultArea
|
||||
v-if="isResultShow"
|
||||
@frameLoad="outputAutoHeight(fromUtools)"
|
||||
@frameLoad="frameLoad"
|
||||
:frameInitHeight="frameInitHeight"
|
||||
:enableHtml="enableHtml"
|
||||
:runResultStatus="runResultStatus"
|
||||
:runResult="runResult"
|
||||
:maxHeight="maxHeight"
|
||||
:key="timeStamp"
|
||||
/>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
@ -30,11 +32,13 @@
|
||||
<div v-else>
|
||||
<ResultArea
|
||||
v-if="isResultShow"
|
||||
@frameLoad="outputAutoHeight(fromUtools)"
|
||||
@frameLoad="frameLoad"
|
||||
:frameInitHeight="frameInitHeight"
|
||||
:enableHtml="enableHtml"
|
||||
:runResultStatus="runResultStatus"
|
||||
:runResult="runResult"
|
||||
:maxHeight="maxHeight"
|
||||
:key="timeStamp"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -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();
|
||||
|
@ -40,7 +40,6 @@ const frameStyle = `<style>::-webkit-scrollbar {
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 10px 20px;
|
||||
color: ${utools.isDarkColors() ? "white" : "unset"}
|
||||
}
|
||||
</style>
|
||||
@ -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);
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user