Fix dark mode sync bug
This commit is contained in:
parent
3725b5bc34
commit
8e9bd0bbd5
1 changed files with 6 additions and 7 deletions
|
@ -145,6 +145,12 @@ os.init(async () => {
|
|||
}
|
||||
}, false)
|
||||
|
||||
os.store.watch(state => state.device.darkMode, darkMode => {
|
||||
// TODO: このファイルでbuiltinThemesを参照するとcode splittingが効かず、初回読み込み時に全てのテーマコードを読み込むことになってしまい無駄なので何とかする
|
||||
const themes = builtinThemes.concat(os.store.state.device.themes);
|
||||
applyTheme(themes.find(x => x.id === (darkMode ? os.store.state.device.darkTheme : os.store.state.device.lightTheme)));
|
||||
});
|
||||
|
||||
//#region Sync dark mode
|
||||
if (os.store.state.device.syncDeviceDarkMode) {
|
||||
os.store.commit('device/set', { key: 'darkMode', value: isDeviceDarkmode() });
|
||||
|
@ -176,13 +182,6 @@ os.init(async () => {
|
|||
isMobile: isMobile
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'$store.state.device.darkMode'() {
|
||||
// TODO: このファイルでbuiltinThemesを参照するとcode splittingが効かず、初回読み込み時に全てのテーマコードを読み込むことになってしまい無駄なので何とかする
|
||||
const themes = builtinThemes.concat(this.$store.state.device.themes);
|
||||
applyTheme(themes.find(x => x.id === (this.$store.state.device.darkMode ? this.$store.state.device.darkTheme : this.$store.state.device.lightTheme)));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
api: os.api,
|
||||
signout: os.signout,
|
||||
|
|
Loading…
Reference in a new issue