mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 22:51:25 +08:00
引入lodash
This commit is contained in:
parent
147fae0bae
commit
9ea88e9286
@ -105,7 +105,7 @@
|
|||||||
flat
|
flat
|
||||||
v-if="!isRunCodePage"
|
v-if="!isRunCodePage"
|
||||||
:disable="!canCommandSave"
|
:disable="!canCommandSave"
|
||||||
color="primary"
|
:color="canCommandSave ? 'primary' : 'grey'"
|
||||||
icon="save"
|
icon="save"
|
||||||
@click="saveCurrentCommand()"
|
@click="saveCurrentCommand()"
|
||||||
><q-tooltip>保存 {{ commandString }}+s</q-tooltip></q-btn
|
><q-tooltip>保存 {{ commandString }}+s</q-tooltip></q-btn
|
||||||
@ -216,10 +216,7 @@ export default {
|
|||||||
this.action.type === "run"
|
this.action.type === "run"
|
||||||
? this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory")
|
? this.$utools.getDB(this.$utools.DBPRE.CFG + "codeHistory")
|
||||||
: this.action.data;
|
: this.action.data;
|
||||||
Object.assign(
|
_.merge(this.quickcommandInfo, quickCommandInfo);
|
||||||
this.quickcommandInfo,
|
|
||||||
JSON.parse(JSON.stringify(quickCommandInfo))
|
|
||||||
);
|
|
||||||
// monoca 相关
|
// monoca 相关
|
||||||
this.$refs.editor.setEditorValue(this.quickcommandInfo.cmd);
|
this.$refs.editor.setEditorValue(this.quickcommandInfo.cmd);
|
||||||
this.setLanguage(this.quickcommandInfo.program);
|
this.setLanguage(this.quickcommandInfo.program);
|
||||||
@ -233,7 +230,7 @@ export default {
|
|||||||
this.quickcommandInfo.cmd = this.$refs.editor.getEditorValue();
|
this.quickcommandInfo.cmd = this.$refs.editor.getEditorValue();
|
||||||
// 保存本次编辑记录
|
// 保存本次编辑记录
|
||||||
this.$utools.putDB(
|
this.$utools.putDB(
|
||||||
JSON.parse(JSON.stringify(this.quickcommandInfo)),
|
_.cloneDeep(this.quickcommandInfo),
|
||||||
this.$utools.DBPRE.CFG + "codeHistory"
|
this.$utools.DBPRE.CFG + "codeHistory"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -409,7 +406,11 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 保存
|
// 保存
|
||||||
saveCurrentCommand() {},
|
saveCurrentCommand() {
|
||||||
|
let updatedData = this.$refs.editor.SaveMenuData();
|
||||||
|
if (!updatedData) return;
|
||||||
|
_.merge(this.quickcommandInfo, updatedData);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -278,9 +278,9 @@ export default {
|
|||||||
let currentQuickCommandCmds = this.getCommandType();
|
let currentQuickCommandCmds = this.getCommandType();
|
||||||
this.cmdType = this.commandTypes[currentQuickCommandCmds.type];
|
this.cmdType = this.commandTypes[currentQuickCommandCmds.type];
|
||||||
this.cmdMatch = currentQuickCommandCmds.match;
|
this.cmdMatch = currentQuickCommandCmds.match;
|
||||||
Object.assign(
|
_.merge(
|
||||||
this.currentCommand,
|
this.currentCommand,
|
||||||
JSON.parse(JSON.stringify(this.quickcommandInfo))
|
_.pick(this.quickcommandInfo, "tags", "output", "features")
|
||||||
);
|
);
|
||||||
this.setIcon(this.currentCommand.program);
|
this.setIcon(this.currentCommand.program);
|
||||||
this.platformVerify();
|
this.platformVerify();
|
||||||
@ -362,6 +362,13 @@ export default {
|
|||||||
"error"
|
"error"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 子输入框
|
||||||
|
if (updateData.cmd.includes("{{subinput")) {
|
||||||
|
updateData.hasSubInput = true;
|
||||||
|
} else {
|
||||||
|
updateData.hasSubInput = false;
|
||||||
|
}
|
||||||
return updateData;
|
return updateData;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -238,9 +238,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 当前标签下的所有快捷命令
|
// 当前标签下的所有快捷命令
|
||||||
currentTagQuickCommands() {
|
currentTagQuickCommands() {
|
||||||
let commands = Object.values(
|
let commands = Object.values(_.cloneDeep(this.allQuickCommands));
|
||||||
JSON.parse(JSON.stringify(this.allQuickCommands))
|
|
||||||
);
|
|
||||||
switch (this.currentTag) {
|
switch (this.currentTag) {
|
||||||
case "未分类":
|
case "未分类":
|
||||||
return commands.filter((cmd) => !cmd.tags || cmd.tags.length === 0);
|
return commands.filter((cmd) => !cmd.tags || cmd.tags.length === 0);
|
||||||
@ -273,17 +271,12 @@ export default {
|
|||||||
},
|
},
|
||||||
// 所有命令对应的标签
|
// 所有命令对应的标签
|
||||||
allQuickCommandTags() {
|
allQuickCommandTags() {
|
||||||
return [
|
return _.union(
|
||||||
...new Set(
|
..._.concat(
|
||||||
// 去重并确保默认在第一位
|
"默认",
|
||||||
Array.prototype.concat
|
|
||||||
.apply(
|
|
||||||
["默认"],
|
|
||||||
Object.values(this.allQuickCommands).map((x) => x.tags)
|
Object.values(this.allQuickCommands).map((x) => x.tags)
|
||||||
)
|
)
|
||||||
.concat(["未分类", "搜索结果"])
|
).concat(["未分类", "搜索结果"]);
|
||||||
),
|
|
||||||
].filter((x) => x);
|
|
||||||
},
|
},
|
||||||
// 标签栏宽度
|
// 标签栏宽度
|
||||||
tabBarWidth() {
|
tabBarWidth() {
|
||||||
@ -352,7 +345,7 @@ export default {
|
|||||||
// 启用命令
|
// 启用命令
|
||||||
enableCommand(code) {
|
enableCommand(code) {
|
||||||
this.$utools.whole.setFeature(
|
this.$utools.whole.setFeature(
|
||||||
JSON.parse(JSON.stringify(this.allQuickCommands[code].features))
|
_.cloneDeep(this.allQuickCommands[code].features)
|
||||||
);
|
);
|
||||||
this.activatedQuickCommandFeatureCodes.push(code);
|
this.activatedQuickCommandFeatureCodes.push(code);
|
||||||
},
|
},
|
||||||
@ -449,7 +442,7 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
let commandsToExport = JSON.parse(JSON.stringify(this.allQuickCommands));
|
let commandsToExport = _.cloneDeep(this.allQuickCommands);
|
||||||
// 不导出默认命令
|
// 不导出默认命令
|
||||||
if (!utools.isDev())
|
if (!utools.isDev())
|
||||||
Object.keys(commandsToExport).forEach((code) => {
|
Object.keys(commandsToExport).forEach((code) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user