a simple library for use vuex easily
yarn add vuex-fast
import vuexFast from 'vuex-fast';
const modules = vuexFast({
a: moduleA,
b: moduleB,
});
const store = new Vuex.Store({ modules });
import vuexFast from 'vuex-fast';
import { createStore } from 'vuex';
const modules = vuexFast({
a: moduleA,
b: moduleB,
});
const store = createStore({ modules });
// State
numeric: {
a: 100,
b: 200
}
// Action
calculate({ state }) {
return {
numeric: {
a: state.a,
b: state.a + state.b
}
}
}
// Use
this.$store.dispatch('calculate');
console.log(this.$store.state.numeric); // { a: 100, b: 300 }