0.0.1 • Published 6 years ago

@madsoap/vix v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

soap-vix

Installation

npm install vix --save-dev

Usage

// store/modules/base.js
export default {
  state: {
    page: {
      state: 'pending'
    },
    mask: {
      show: false
    }
  },
  mutators: {
    INIT ({state,dispatch},action) {
      state.state = 'ready';
      dispatch({
        type: 'FETCH_USER'
      })
    }
  }
}
// store/modules/user.js
export default {
  state: {
    user: {
      loggedIn: false,
      name: ''
    }
  },
  mutators: {
    FETCH_USER ({state,dispatch},action) {
      state.user.loggedIn = true;
      state.user.name = 'root';
    }
  }
}
// store/store.js
import Vue from 'vue';
import Vix from 'soap-vix';
import base from 'store/modules/base.js';
import user from 'store/modules/user.js';
Vue.use( Vix );

const store = Vix.createStore([base,user]);

new Vue({
  store
})

License

MIT