vill-vuex

1.0.1 • Public • Published

vill-vuex

a vue plugins about data manage

Build Setup

install the plugin on bash and the sass module support

npm install vill-vuex --save-dev

register the plugins on the vue project in the entry file (main.js)

import vuex from 'vill-vuex'
Vue.use(vuex);

on the store file ,you can use it by the follow example

import Vue from "vue";
import Vuex from "../util/index";
Vue.use(Vuex);
export default new Vuex.Store({
  state: {
    name: "kiwis",
    age: 22,
    job: "front-end-engineer"
  },
  mutations: {
    increAge(state, n = 1) {
      state.age += n;
    }
  },
  actions:{
    plus(context,n){
      console.log(context);
      console.log(context.commit('increAge',n));
    }
  }
});

in the main entry file ,you need import store file to vuejs options

import Vue from 'vue'
import App from './App'
import store from './store/index';
import router from "./router";
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>'
})

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i vill-vuex

Weekly Downloads

2

Version

1.0.1

License

none

Unpacked Size

31.9 kB

Total Files

25

Last publish

Collaborators

  • kiwis