Tidied up component structure

This commit is contained in:
jtc42 2019-06-10 19:26:19 +01:00
parent c002ceccbd
commit 2327b9b8bf
19 changed files with 224 additions and 379 deletions

View file

@ -0,0 +1,46 @@
<template>
<div id="appSettings">
<p><label><input v-model="darkMode" class="uk-checkbox" type="checkbox"> Enable dark theme</label></p>
</div>
</template>
<script>
// Export main app
export default {
name: 'appSettings',
data: function () {
return {}
},
mounted() {
// Try loading settings from localStorage. If null, don't change.
this.darkMode = this.getLocalStorageObj('darkMode') || this.darkMode
},
watch: {
darkMode(newdarkMode) {
console.log("Saving darkmode setting")
this.setLocalStorageObj('darkMode', this.darkMode)
}
},
computed: {
darkMode: {
get() {
return this.$store.state.globalSettings.darkMode;
},
set(value) {
this.$store.commit("changeSetting", ['darkMode', value]);
}
}
}
}
</script>
<style lang="less">
</style>