This commit is contained in:
syuilo 2018-05-24 06:08:23 +09:00
parent 4798657b70
commit cb5c0ac2f5
1 changed files with 12 additions and 3 deletions

View File

@ -21,10 +21,20 @@ export default Vue.extend({
$route: 'fetch' $route: 'fetch'
}, },
created() { created() {
const applyBg = v =>
document.documentElement.style.setProperty('background', v ? '#191b22' : '#fff', 'important');
applyBg(this.$store.state.device.darkmode);
this.unwatchDarkmode = this.$store.watch(s => {
return s.device.darkmode;
}, applyBg);
this.fetch(); this.fetch();
}, },
mounted() { beforeDestroy() {
document.documentElement.style.background = '#fff'; document.documentElement.style.removeProperty('background');
this.unwatchDarkmode();
}, },
methods: { methods: {
fetch() { fetch() {
@ -50,6 +60,5 @@ export default Vue.extend({
flex 1 flex 1
flex-direction column flex-direction column
min-height 100% min-height 100%
background #fff
</style> </style>