Darken
This commit is contained in:
@@ -16,16 +16,29 @@ export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
fetching: true,
|
||||
user: null
|
||||
user: null,
|
||||
unwatchDarkmode: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$route: 'fetch'
|
||||
},
|
||||
created() {
|
||||
document.documentElement.style.background = '#fff';
|
||||
const applyBg = v =>
|
||||
document.documentElement.style.setProperty('background', v ? '#191b22' : '#fff', 'important');
|
||||
|
||||
this.$nextTick(() => applyBg(this.$store.state.device.darkmode));
|
||||
|
||||
this.unwatchDarkmode = this.$store.watch(s => {
|
||||
return s.device.darkmode;
|
||||
}, applyBg);
|
||||
|
||||
this.fetch();
|
||||
},
|
||||
beforeDestroy() {
|
||||
document.documentElement.style.removeProperty('background');
|
||||
this.unwatchDarkmode();
|
||||
},
|
||||
methods: {
|
||||
fetch() {
|
||||
this.fetching = true;
|
||||
|
Reference in New Issue
Block a user