mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-19 18:25:44 +08:00
为大部分命令添加输出结构结构化数据
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<OperationCard
|
||||
v-if="hasSubCommands"
|
||||
:model-value="funcName"
|
||||
@update:model-value="updateFuncName"
|
||||
@update:model-value="funcName = $event"
|
||||
:options="localCommand.subCommands"
|
||||
/>
|
||||
<ParamInput :configs="localConfig" :values="argvs" @update="updateArgv" />
|
||||
@@ -77,7 +77,7 @@ export default defineComponent({
|
||||
newArgvs[this.commonConfig.length + index] = config.defaultValue;
|
||||
});
|
||||
|
||||
this.updateModelValue(value, newArgvs);
|
||||
this.updateModelValue(value, newArgvs, true);
|
||||
},
|
||||
},
|
||||
argvs() {
|
||||
@@ -189,14 +189,18 @@ export default defineComponent({
|
||||
);
|
||||
return `${subFeature}${allArgvs.join(",")}`;
|
||||
},
|
||||
updateModelValue(funcName, argvs) {
|
||||
this.$emit("update:modelValue", {
|
||||
updateModelValue(funcName, argvs, resetOutputVariable = false) {
|
||||
const newModelValue = {
|
||||
...this.modelValue,
|
||||
value: funcName,
|
||||
argvs,
|
||||
summary: this.getSummary(argvs),
|
||||
code: this.generateCode(funcName, argvs),
|
||||
});
|
||||
};
|
||||
if (resetOutputVariable) {
|
||||
delete newModelValue.outputVariable;
|
||||
}
|
||||
this.$emit("update:modelValue", newModelValue);
|
||||
},
|
||||
getColumnStyle(width = 12) {
|
||||
const columnWidth = (width / 12) * 100;
|
||||
@@ -204,15 +208,6 @@ export default defineComponent({
|
||||
width: `calc(${columnWidth}% - var(--grid-gap))`,
|
||||
};
|
||||
},
|
||||
updateFuncName(value) {
|
||||
this.funcName = value;
|
||||
// 如果切换了子命令,更新输出变量
|
||||
const selectSubCommand = this.getSelectSubCommand(value);
|
||||
if (!selectSubCommand) return;
|
||||
const newModelValue = { ...this.modelValue, value: value };
|
||||
delete newModelValue.outputVariable;
|
||||
this.$emit("update:modelValue", newModelValue);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
const argvs = this.modelValue.argvs || this.defaultArgvs;
|
||||
|
||||
Reference in New Issue
Block a user