1.0.3 • Published 4 years ago

@johnnywang/vuex-loader v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

vuex-loader

This plugin is a webpack-loader, which could only be set in your webpack condig file, a new runtime compile version has be published

Please refer to: Vuexess

This is a simple webpack loader which helps import vuex data without using any mapState, mapActions...

Install

$ npm install @johnnywang/vuex-loader

then just use right below(which will load before) your webpack's vue-loader:

it will automatically import all the vuex data you want to each components.

module.exports = {
  modules: {
    test: /\.vue$/,
    loader: [
      'vue-loader',
      '@johnnywang/vuex-loader',
    ],
  },
}

Usage

Use vuex option in each vue component:

No matter vuex or Vuex, it is case-insensitive.

export default {
  name: 'SampleComponent',
  vuex: {
    state: ['profile', 'todoList'],
    actions: ['getProfile', 'getTodos'],
    Login: {
      state: ['loginStatus'],
      actions: ['postLogin'],
    }
  },
};

Params in vuex options

moduleName below is the module name which you had registered in your vuex.

this plugin will not check anything, which totally relys on vuex. so totally without any side effect.

ParamTypeDescription
statearray or objectrootState of vuex
gettersarray or objectrootGetters of vuex
mutationsarray or objectrootMutations of vuex
actionsarray or objectrootActions of vuex
moduleNameobjectmodules registered in vuex

License

MIT

Copyright (c) 2020-present, Johnny Wang

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago