diff --git a/src/components/CommandCard.vue b/src/components/CommandCard.vue
index 0a1d951..8b83754 100644
--- a/src/components/CommandCard.vue
+++ b/src/components/CommandCard.vue
@@ -11,7 +11,7 @@
{
- // 先点一次,如果是停用状态则被启用
- // 如果是启用状态则停用
- let dom = document.getElementById(this.quickcommandInfo.features.code);
- dom.querySelector(".q-toggle")?.click();
- // 如果之前一次点击是启用则不点
- // 如果之前一次点击是停用则再点一次启用,达到刷新目的
- this.$nextTick(() => {
- dom.querySelector(".q-toggle[aria-checked='false']")?.click();
- });
- });
},
// 运行
runCurrentCommand() {
diff --git a/src/pages/ConfigurationPage.vue b/src/pages/ConfigurationPage.vue
index 6dd75a8..bcb39bb 100644
--- a/src/pages/ConfigurationPage.vue
+++ b/src/pages/ConfigurationPage.vue
@@ -69,7 +69,7 @@
v-for="commandInfo in currentTagQuickCommands"
:key="commandInfo.features.code"
:commandInfo="commandInfo"
- :activated="
+ :isCommandActivated="
activatedQuickCommandFeatureCodes.includes(
commandInfo.features.code
)
@@ -537,14 +537,24 @@ export default {
};
this.isCommandEditorShow = true;
},
+ saveCommand(command) {
+ let code = command.features.code;
+ this.allQuickCommands[code] = command;
+ //无论禁用还是启用都启用
+ if (!this.activatedQuickCommandFeatureCodes.includes(code))
+ this.activatedQuickCommandFeatureCodes.push(code);
+ // 先删除再添加,强制刷新
+ this.$utools.whole.removeFeature(code);
+ this.$utools.whole.setFeature(command.features);
+ this.locateToCommand(command.tags, code);
+ },
editorEvent(event) {
switch (event.type) {
case "close":
this.isCommandEditorShow = false;
return;
case "save":
- this.allQuickCommands[event.data.features.code] = event.data;
- this.locateToCommand(event.data.tags, event.data.features.code);
+ this.saveCommand(event.data);
default:
return;
}