Skip to content

Instantly share code, notes, and snippets.

@meshboy
Created September 13, 2018 00:58
Show Gist options
  • Save meshboy/6bea5365b1fde6b99163db87fd05c9fa to your computer and use it in GitHub Desktop.
Save meshboy/6bea5365b1fde6b99163db87fd05c9fa to your computer and use it in GitHub Desktop.
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
export const store = new Vuex.Store({
state: {
counter: 0
},
getters: {
/**
* access counter in state from the paramater
*/
addCurrencyToCounter: function (state) {
return `$ ${state.counter} (dollars)`;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment