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