const state = {
now: new Date
}
const actions = {
start ({ commit }) {
setInterval(() => {
commit('UPDATE_TIME')
}, 1000)
}
}
const mutations = {
UPDATE_TIME(state) {
state.now = new Date
}
}
computed: {
...mapState(['now'])
}