mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-10-10 23:53:29 +08:00
新增创建命令副本
This commit is contained in:
@@ -59,6 +59,13 @@
|
|||||||
<q-item-section>复制到剪贴板</q-item-section>
|
<q-item-section>复制到剪贴板</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
|
<q-item clickable v-close-popup @click="createCommandCopy">
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="file_copy" />
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>创建命令副本</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
|
||||||
<q-item clickable @click="shareCommand" v-close-popup>
|
<q-item clickable @click="shareCommand" v-close-popup>
|
||||||
<q-item-section side>
|
<q-item-section side>
|
||||||
<q-icon name="share" />
|
<q-icon name="share" />
|
||||||
@@ -189,6 +196,13 @@ export default {
|
|||||||
`「${this.commandInfo.features.explain}」已复制到剪贴板`
|
`「${this.commandInfo.features.explain}」已复制到剪贴板`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
// 创建命令副本
|
||||||
|
createCommandCopy() {
|
||||||
|
this.$emit("commandChanged", {
|
||||||
|
type: "createCopy",
|
||||||
|
data: this.featureCode,
|
||||||
|
});
|
||||||
|
},
|
||||||
// 导出到文件
|
// 导出到文件
|
||||||
exportCommandFile() {
|
exportCommandFile() {
|
||||||
window.saveFile(JSON.stringify(this.getRawCommand()), {
|
window.saveFile(JSON.stringify(this.getRawCommand()), {
|
||||||
|
@@ -210,6 +210,13 @@ export function useCommandManager() {
|
|||||||
return parsedData.qc;
|
return parsedData.qc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 创建命令副本
|
||||||
|
const createCommandCopy = (code) => {
|
||||||
|
const command = window.lodashM.cloneDeep(state.allQuickCommands[code]);
|
||||||
|
command.features.code = getFeatureCode(command.features.cmds);
|
||||||
|
saveCommand(command);
|
||||||
|
};
|
||||||
|
|
||||||
// 是否为默认命令
|
// 是否为默认命令
|
||||||
const isDefaultCommand = (code) => {
|
const isDefaultCommand = (code) => {
|
||||||
return code.slice(0, 8) === "default_";
|
return code.slice(0, 8) === "default_";
|
||||||
@@ -349,6 +356,7 @@ export function useCommandManager() {
|
|||||||
enableCommand,
|
enableCommand,
|
||||||
disableCommand,
|
disableCommand,
|
||||||
importCommand,
|
importCommand,
|
||||||
|
createCommandCopy,
|
||||||
isDefaultCommand,
|
isDefaultCommand,
|
||||||
exportAllCommands,
|
exportAllCommands,
|
||||||
getActivatedFeatures,
|
getActivatedFeatures,
|
||||||
|
@@ -132,6 +132,9 @@ export default {
|
|||||||
case "run":
|
case "run":
|
||||||
this.runCommand(event.data);
|
this.runCommand(event.data);
|
||||||
return;
|
return;
|
||||||
|
case "createCopy":
|
||||||
|
this.createCommandCopy(event.data);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -157,6 +160,10 @@ export default {
|
|||||||
this.changeCurrentTag("默认");
|
this.changeCurrentTag("默认");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 创建命令副本
|
||||||
|
createCommandCopy(code) {
|
||||||
|
this.commandManager.createCommandCopy(code);
|
||||||
|
},
|
||||||
// 编辑命令
|
// 编辑命令
|
||||||
editCommand(commandOrCode) {
|
editCommand(commandOrCode) {
|
||||||
// 即可传入 code,也可直接传入 command
|
// 即可传入 code,也可直接传入 command
|
||||||
|
Reference in New Issue
Block a user