Merge branch 'prod'
commit
c1a78ef922
21
app.vue
21
app.vue
|
@ -22,17 +22,28 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.themeChangeListener = (event) => {
|
this.themeChangeListener = (event) => {
|
||||||
this.$primevue.changeTheme(this.$appState.theme, event.theme, 'theme-link', () => {
|
if (!document.startViewTransition) {
|
||||||
this.$appState.theme = event.theme;
|
this.applyTheme(event);
|
||||||
this.$appState.darkTheme = event.dark;
|
|
||||||
EventBus.emit('theme-change-complete', { theme: event.theme, dark: event.dark });
|
return;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
document.startViewTransition(() => this.applyTheme(event));
|
||||||
};
|
};
|
||||||
|
|
||||||
EventBus.on('theme-change', this.themeChangeListener);
|
EventBus.on('theme-change', this.themeChangeListener);
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
EventBus.off('theme-change', this.themeChangeListener);
|
EventBus.off('theme-change', this.themeChangeListener);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
applyTheme(event) {
|
||||||
|
this.$primevue.changeTheme(this.$appState.theme, event.theme, 'theme-link', () => {
|
||||||
|
this.$appState.theme = event.theme;
|
||||||
|
this.$appState.darkTheme = event.dark;
|
||||||
|
EventBus.emit('theme-change-complete', { theme: event.theme, dark: event.dark });
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue