vuex-isloading

0.0.1 • Public • Published

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() }}

Readme

Keywords

none

Package Sidebar

Install

npm i vuex-isloading

Weekly Downloads

0

Version

0.0.1

License

none

Unpacked Size

14.3 kB

Total Files

11

Last publish

Collaborators

  • chiaweilee