mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-28 20:02:44 +08:00
异步读取feature和command
This commit is contained in:
parent
b0091e429e
commit
6250e085a4
@ -224,7 +224,7 @@ export default {
|
|||||||
lastTag: "",
|
lastTag: "",
|
||||||
activatedQuickCommandFeatureCodes: [],
|
activatedQuickCommandFeatureCodes: [],
|
||||||
activatedQuickPanels: [],
|
activatedQuickPanels: [],
|
||||||
allQuickCommands: [],
|
allQuickCommands: {},
|
||||||
commandSearchKeyword: "",
|
commandSearchKeyword: "",
|
||||||
isCommandEditorShow: false,
|
isCommandEditorShow: false,
|
||||||
commandEditorAction: {},
|
commandEditorAction: {},
|
||||||
@ -317,25 +317,15 @@ export default {
|
|||||||
else this.editCommand(JSON.parse(this.$root.enterData.payload));
|
else this.editCommand(JSON.parse(this.$root.enterData.payload));
|
||||||
this.$router.push("/configuration");
|
this.$router.push("/configuration");
|
||||||
}
|
}
|
||||||
// 已启用的 features
|
|
||||||
let activatedFeatures = this.getActivatedFeatures();
|
|
||||||
// 已启用的命令的 featureCode
|
|
||||||
this.activatedQuickCommandFeatureCodes =
|
|
||||||
activatedFeatures.quickcommand.map((f) => f.code);
|
|
||||||
// 已启用的面板
|
|
||||||
this.activatedQuickPanels = activatedFeatures.quickpanels;
|
|
||||||
// 所有的快捷命令
|
|
||||||
this.allQuickCommands = this.getAllQuickCommands();
|
|
||||||
this.importDefaultCommands();
|
|
||||||
if (this.$route.params.tags) {
|
if (this.$route.params.tags) {
|
||||||
this.currentTag = window.hexDecode(this.$route.params.tags);
|
this.currentTag = window.hexDecode(this.$route.params.tags);
|
||||||
this.commandCardStyle = "mini";
|
this.commandCardStyle = "mini";
|
||||||
}
|
}
|
||||||
|
// 异步读取
|
||||||
|
setTimeout(this.getActivatedFeatures, 0);
|
||||||
|
setTimeout(this.getAllQuickCommands, 0);
|
||||||
},
|
},
|
||||||
importDefaultCommands() {
|
importDefaultCommands() {
|
||||||
for (var code of Object.keys(defaultCommands)) {
|
|
||||||
this.$root.utools.putDB(defaultCommands[code], "qc_" + code);
|
|
||||||
}
|
|
||||||
Object.assign(this.allQuickCommands, defaultCommands);
|
Object.assign(this.allQuickCommands, defaultCommands);
|
||||||
},
|
},
|
||||||
// 获取所有已启用的命令的 features 以及面板名称
|
// 获取所有已启用的命令的 features 以及面板名称
|
||||||
@ -348,18 +338,17 @@ export default {
|
|||||||
? quickpanels.push(window.hexDecode(x.code.slice(6)))
|
? quickpanels.push(window.hexDecode(x.code.slice(6)))
|
||||||
: currentFts.push(x)
|
: currentFts.push(x)
|
||||||
);
|
);
|
||||||
return {
|
this.activatedQuickCommandFeatureCodes = currentFts.map((f) => f.code);
|
||||||
quickcommand: currentFts,
|
// 已启用的面板
|
||||||
quickpanels: quickpanels,
|
this.activatedQuickPanels = quickpanels;
|
||||||
};
|
|
||||||
},
|
},
|
||||||
// 获取所有的快捷命令(导出的格式)
|
// 获取所有的快捷命令(导出的格式)
|
||||||
getAllQuickCommands() {
|
getAllQuickCommands() {
|
||||||
let allQcs = {};
|
this.allQuickCommands = {};
|
||||||
this.$root.utools
|
this.$root.utools
|
||||||
.getDocs("qc_")
|
.getDocs("qc_")
|
||||||
.forEach((x) => (allQcs[x.data.features.code] = x.data));
|
.forEach((x) => (this.allQuickCommands[x.data.features.code] = x.data));
|
||||||
return allQcs;
|
this.importDefaultCommands();
|
||||||
},
|
},
|
||||||
// 监听命令变更事件
|
// 监听命令变更事件
|
||||||
commandChanged(event) {
|
commandChanged(event) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user