编辑命令界面也需要临时赋值

This commit is contained in:
fofolee 2022-04-12 13:06:51 +08:00
parent 0666644d02
commit 3ba0d01915
3 changed files with 13 additions and 13 deletions

View File

@ -353,10 +353,10 @@ export default {
}, },
// //
runCurrentCommand() { runCurrentCommand() {
// action run text let command = _.cloneDeep(this.quickcommandInfo);
this.quickcommandInfo.output = command.output = this.$refs.menu?.currentCommand.output || "text";
this.$refs.menu?.currentCommand.output || "text"; command.cmdType = this.$refs.menu?.cmdType.name;
this.$refs.result.runCurrentCommand(_.cloneDeep(this.quickcommandInfo)); this.$refs.result.runCurrentCommand(command);
}, },
}, },
}; };

View File

@ -60,8 +60,8 @@ export default {
props: { props: {
/** /**
* run RunCode界面 无侧栏运行结果弹窗显示保存命令历史 * run RunCode界面 无侧栏运行结果弹窗显示保存命令历史
* edit 编辑命令界面 有侧栏运行结果弹窗显示 * edit 编辑命令界面 有侧栏运行结果弹窗显示需要对payload临时赋值
* new 新建命令界面 有侧栏运行结果弹窗显示 * new 新建命令界面 有侧栏运行结果弹窗显示需要对payload临时赋值
* config 配置界面 运行结果弹窗显示需要对payload临时赋值 * config 配置界面 运行结果弹窗显示需要对payload临时赋值
* input 主输入框进入 运行结果直接展示动态调整窗体高度 * input 主输入框进入 运行结果直接展示动态调整窗体高度
*/ */
@ -75,7 +75,7 @@ export default {
return this.action.type === "input"; return this.action.type === "input";
}, },
needTempPayload() { needTempPayload() {
return this.action.type === "config"; return ["edit", "new", "config"].includes(this.action.type);
}, },
}, },
methods: { methods: {
@ -161,11 +161,11 @@ export default {
// payload // payload
async getTempPayload(currentCommand) { async getTempPayload(currentCommand) {
if (!this.needTempPayload) return; if (!this.needTempPayload) return;
let cmd = currentCommand.features.cmds[0]; let type =
let type = cmd.type; currentCommand.cmdType || currentCommand.features?.cmds[0].type;
quickcommand.enterData = { quickcommand.enterData = {
type: cmd.type || "text", type: type || "text",
payload: (await commandTypes[type]?.tempPayload?.()) || cmd, payload: await commandTypes[type]?.tempPayload?.(),
}; };
}, },
// //

View File

@ -130,7 +130,7 @@ const commandTypes = {
}], }],
verify: rules => true, verify: rules => true,
tempPayload: () => window.getBase64Ico(utools.showOpenDialog({ tempPayload: () => window.getBase64Ico(utools.showOpenDialog({
title: "需要处理的文件", title: "需要处理的图片",
filters: [{ filters: [{
name: 'Images', name: 'Images',
extensions: ['png', extensions: ['png',