soap-vix
v0.0.3
Published
A vuex-like state manager for vue.js.
Downloads
3
Readme
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