maiwenan / vuex-wait

Loading indicator plugin for Vuex

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vuex-wait

Adds loading state for actions to Vuex automatically. You don't need to maintain asynchronous action state any more. Inspired by dva-loading.

Install

npm install vuex-wait --save

Usage

import Vue from 'vue';
import Vuex from 'vuex';
import createLoading from 'vuex-wait';

Vue.use(Vuex);

const options = {};
const store = new Vuex.Store({
  plugins: [ createLoading(options) ]
});

Then we can access loading state from store.

Options

name

{ name: 'girl' }

In which case, loading can be accessed from store.state.girl

Defaults to loading

State Structure

{
  loading: {
    global: false,
    actions: {
      increment: false,
      incrementAsync: false
    }
  }
}

License

MIT

About

Loading indicator plugin for Vuex

License:MIT License


Languages

Language:JavaScript 40.8%Language:TypeScript 36.1%Language:Vue 19.8%Language:HTML 3.4%