15.04 Add a Computed Getter & Setter
This commit is contained in:
parent
fe08b091e7
commit
ff3233fa49
@ -19,15 +19,23 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'PageSettings',
|
||||
computed: {
|
||||
...mapGetters('settings', ['settings']),
|
||||
show12HourTimeFormat () {
|
||||
show12HourTimeFormat: {
|
||||
get () {
|
||||
return this.settings.show12HourTimeFormat
|
||||
},
|
||||
set (value) {
|
||||
this.setShow12HourTimeFormat(value)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('settings', ['setShow12HourTimeFormat'])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -5,9 +5,15 @@ const state = {
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
setShow12HourTimeFormat (state, value) {
|
||||
state.settings.show12HourTimeFormat = value
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
setShow12HourTimeFormat ({ commit }, value) {
|
||||
commit('setShow12HourTimeFormat', value)
|
||||
}
|
||||
}
|
||||
|
||||
const getters = {
|
||||
|
Loading…
Reference in New Issue
Block a user