0.0.1 • Published 6 years ago
vuex-isloading v0.0.1
Vuex-IsLoading
Install
npm install vuex-isloading
Usage
- use isLoading in Vuex's plugins
import Vuex from 'vuex'
import isloading, { next, is } from '../src'
const router = new Vuex({
...
plugins: [
isloading
]
})
- add $is into getters
import isloading, { next, is } from '../src'
const store = {
state: {},
getters: {
$is: is
}
}
- callback in actions
import isloading, { next, is } from '../src'
const store = {
state: {},
actions: {
testES6 () {
$http.get('www.github.com')
.then(() => {
next.apply(this, arguments)
})
},
testES5 () {
const _this = this
const _arg = arguments
$http.get('www.github.com')
.then(function () {
next.apply(_this, _arg)
})
}
}
}
get loading status
- is any loading
{{ $store.getters.$is.anyLoading() }}
- is xxx loading
{{ $store.getters.$is.loading('testES5') }}
{{ $store.getters.$is.loading(['testES5', 'testES6']) }}
- all loadings name
{{ $store.getters.$is.loadings() }}
0.0.1
6 years ago