vuex-fast

a simple library for use vuex easily

Usage no npm install needed!

<script type="module">
  import vuexFast from 'https://cdn.skypack.dev/vuex-fast';
</script>

README

vue-fast

a simple library for use vuex easily

yarn add vuex-fast

init in vue2

import vuexFast from 'vuex-fast';

const modules = vuexFast({
  a: moduleA,
  b: moduleB,
});

const store = new Vuex.Store({ modules });

init in vue3

import vuexFast from 'vuex-fast';

import { createStore } from 'vuex';

const modules = vuexFast({
  a: moduleA,
  b: moduleB,
});

const store = createStore({ modules });

use

// 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 }