mirror of
https://github.com/tuanzisama/minecraft-color-gradient-generator.git
synced 2025-02-17 12:00:02 +08:00
fix: vanillaCharCode not saved correctly
This commit is contained in:
parent
ef3f28c6de
commit
1649682b68
@ -61,8 +61,8 @@ onMounted(() => {
|
||||
const element = toolbars[i];
|
||||
const key = element.key;
|
||||
|
||||
if (element.hasOwnProperty("isActive")) {
|
||||
element.isActive = appStore.setting.format[key as never] as boolean;
|
||||
if (key === ToolBarModule.VANILLA_CHAR_CODE) {
|
||||
element.isActive = appStore.setting.format.vanillaCharCode === '§';
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -71,7 +71,7 @@ const onToolbarItemClickHandler = (item: ToolBarItem) => {
|
||||
switch (item.key) {
|
||||
case "vanillaCharCode":
|
||||
item.isActive = !item.isActive;
|
||||
appStore.setting.format.vanillaCharCode = item.isActive ? "§" : "&";
|
||||
appStore.setVanillaCharCode(item.isActive ? "§" : "&");
|
||||
emit("on-format-change");
|
||||
break;
|
||||
case "copy":
|
||||
|
@ -31,6 +31,11 @@ export const useAppStore = defineStore("app", {
|
||||
return adapterMap.get(state.setting.usingAdapterKey);
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setVanillaCharCode(code: AppStoreState["setting"]["format"]["vanillaCharCode"]) {
|
||||
this.setting.format.vanillaCharCode = code;
|
||||
},
|
||||
},
|
||||
persist: {
|
||||
paths: ["setting"],
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user