Store Page
export const mutations = {
increment_mutation (state, payload) {
state.counter++
state.click_date = payload.click_date
}
}
export const actions = {
increment_action ({ commit }, payload) {
commit('increment_mutation', { click_date: payload.click_date })
}
}
export const state = () => ({
counter: 0,
click_date: ""
})
computed: {
counter() { return this.$store.state.counter },
click_date() { return this.$store.state.click_date }
}
methods: {
increment() {
this.$store.dispatch('increment_action', { click_date: new Date })
}
}
{{counter}}
{{click_date}}
カウントアップ