mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 06:16:27 +08:00
添加quickcommandUI在点击取消按钮和点击空白退出时的回调
This commit is contained in:
parent
a954cf0764
commit
5691a8e48e
@ -24,6 +24,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
setCssVar: setCssVar,
|
setCssVar: setCssVar,
|
||||||
programs: programmings,
|
programs: programmings,
|
||||||
|
isRunningCommand: false,
|
||||||
profile: defaultProfile.common,
|
profile: defaultProfile.common,
|
||||||
nativeProfile: defaultProfile.native,
|
nativeProfile: defaultProfile.native,
|
||||||
utools: UTOOLS,
|
utools: UTOOLS,
|
||||||
|
@ -126,6 +126,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 运行命令
|
// 运行命令
|
||||||
async runCurrentCommand(currentCommand) {
|
async runCurrentCommand(currentCommand) {
|
||||||
|
this.$root.isRunningCommand = true;
|
||||||
await this.getTempPayload(currentCommand);
|
await this.getTempPayload(currentCommand);
|
||||||
if (currentCommand.cmd.includes("{{subinput"))
|
if (currentCommand.cmd.includes("{{subinput"))
|
||||||
return this.setSubInput(currentCommand);
|
return this.setSubInput(currentCommand);
|
||||||
@ -284,6 +285,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
handleResult(stdout, stderr, options) {
|
handleResult(stdout, stderr, options) {
|
||||||
|
this.$root.isRunningCommand = false;
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
return options.earlyExit
|
return options.earlyExit
|
||||||
? alert(stderr)
|
? alert(stderr)
|
||||||
@ -293,6 +295,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 显示运行结果
|
// 显示运行结果
|
||||||
async showRunResult(content, isSuccess) {
|
async showRunResult(content, isSuccess) {
|
||||||
|
this.$root.isRunningCommand = false;
|
||||||
content = await this.handleContent(content);
|
content = await this.handleContent(content);
|
||||||
this.runResultStatus = isSuccess;
|
this.runResultStatus = isSuccess;
|
||||||
this.runResult = this.runResult.concat(content);
|
this.runResult = this.runResult.concat(content);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
:maximized="maximized"
|
:maximized="maximized"
|
||||||
:transition-show="maximized ? 'fade' : 'scale'"
|
:transition-show="maximized ? 'fade' : 'scale'"
|
||||||
:transition-hide="maximized ? 'fade' : 'scale'"
|
:transition-hide="maximized ? 'fade' : 'scale'"
|
||||||
|
@hide="hideDialog"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
ref="ui"
|
ref="ui"
|
||||||
@ -262,12 +263,32 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
clickOK() {},
|
clickOK() {},
|
||||||
wbEvent() {},
|
wbEvent() {},
|
||||||
|
hideDialog() {},
|
||||||
showUI(uiComponent, options, maximized, reslove) {
|
showUI(uiComponent, options, maximized, reslove) {
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.maximized = maximized;
|
this.maximized = maximized;
|
||||||
this.currentUI = uiComponent;
|
this.currentUI = uiComponent;
|
||||||
this.clickOK = reslove;
|
this.clickOK = reslove;
|
||||||
|
this.hideDialog = () => {
|
||||||
|
switch (uiComponent) {
|
||||||
|
case InputBox:
|
||||||
|
reslove([]);
|
||||||
|
break;
|
||||||
|
case ButtonBox:
|
||||||
|
case SelectList:
|
||||||
|
reslove({});
|
||||||
|
break;
|
||||||
|
case ConfirmBox:
|
||||||
|
reslove(false);
|
||||||
|
break;
|
||||||
|
case TextArea:
|
||||||
|
reslove("");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
reslove(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user