1.2.1 • Published 6 years ago

vuex-store-plugins v1.2.1

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

vuex-store-plugins

Some plugins for vuex store.

How to use

$ npm install -S vuex-store-plugins

Example

  1. loadingPlugins
import Vue from 'vue'
import Vuex from 'vuex'
import { loadingPlugins } from 'vuex-store-plugins'

Vue.use(Vuex)

const storeOptions = {
  state: {},
  mutations: {},
  actions: {
    async foo() {
      const d = await new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve(1)
        }, 3000)
      })
    }
  }
}

const store = loadingPlugins(Vuex, storeOptions, 'loading', true)
export default store

// * The last two parameter can be transfered,
// * The third parameter initial value is 'loadingState',
// * The fourth parameter initial value is false, if you need log set it true.
// * You will have a module named 'loading' to monitor all actions start and end.
// * Like before ,the store.state.loading.foo is monitor 'foo' action

MIT

1.2.1

6 years ago

1.2.0

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago