mirror of
https://github.com/gedoor/legado.git
synced 2025-01-08 11:47:32 +08:00
chore(web): sync readconfig only when readSetting unvisible
This commit is contained in:
parent
b80e54927e
commit
28f11e148b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user