chore(web): sync readconfig only when readSetting unvisible

This commit is contained in:
Xwite 2024-10-05 06:38:31 +08:00
parent b80e54927e
commit 28f11e148b

View File

@ -192,16 +192,25 @@ import API from "@api";
const store = useBookStore();
//
let configChanged = false;
watch(
() => store.config,
(newValue) => {
localStorage.setItem("config", JSON.stringify(newValue));
API.saveReadConfig(newValue);
configChanged = true;
},
{
deep: 2, //2
},
);
// APP
watch(
() => store.readSettingsVisible,
(visbile) => {
if (!visbile && configChanged)
API.saveReadConfig(store.config).then(() => (configChanged = false));
},
);
//
const theme = computed(() => store.theme);