Remove stateful dark
parent
9027b573ad
commit
dc77753537
9
app.vue
9
app.vue
|
@ -8,14 +8,6 @@
|
||||||
import EventBus from '@/layouts/AppEventBus';
|
import EventBus from '@/layouts/AppEventBus';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
beforeMount() {
|
|
||||||
const isDark = localStorage['primevue-theme'] === 'dark' || (!('primevue-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
||||||
|
|
||||||
if (isDark) document.documentElement.classList.add('p-dark');
|
|
||||||
else document.documentElement.classList.remove('p-dark');
|
|
||||||
|
|
||||||
this.$appState.darkTheme = isDark;
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
EventBus.on('theme-change', this.themeChangeListener);
|
EventBus.on('theme-change', this.themeChangeListener);
|
||||||
},
|
},
|
||||||
|
@ -38,7 +30,6 @@ export default {
|
||||||
if (isDark) document.documentElement.classList.add('p-dark');
|
if (isDark) document.documentElement.classList.add('p-dark');
|
||||||
else document.documentElement.classList.remove('p-dark');
|
else document.documentElement.classList.remove('p-dark');
|
||||||
|
|
||||||
localStorage['primevue-theme'] = isDark ? 'dark' : 'light';
|
|
||||||
this.$appState.darkTheme = isDark;
|
this.$appState.darkTheme = isDark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue