You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
358 B
21 lines
358 B
const state = () => ({
|
|
count: 0,
|
|
});
|
|
const getters = {
|
|
doubleCount: (state) => state.count * 2,
|
|
};
|
|
const mutations = {
|
|
add: (state, num = 1) => (state.count += num),
|
|
};
|
|
const actions = {
|
|
clear: ({ state, commit }) => {
|
|
commit('add', state.count * -1);
|
|
},
|
|
};
|
|
export default {
|
|
state,
|
|
getters,
|
|
mutations,
|
|
actions,
|
|
};
|