generate-vuex
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

generate-vuex

master action

Generate-Vuex maybe can use as a plugin which makes you feel better when you use vuex. You need not to write simple mutation functions any more if you use it.

使用

在 vuex 的任意一个子 module 中使用, 将自动生成 mutations 和 getters, 不用再重复写它了~

import { setFuncName, generateGetters, generateMutations } from 'generate-vuex'
 
const state = {
  msg: 'haha'
}
const mutations = {
  ...generateMutations(state)
}
const actions = {
  asyncChangeMsg({ commit }) {
    setTimeout(() => {
      commit(setFuncName('msg'), 'async heihei')
    }, 1000)
  }
}
const getters = {
  ...generateGetters(state)
}
 
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.4.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.4.0
    0
  • 1.3.0
    0
  • 1.2.0
    0

Package Sidebar

Install

npm i generate-vuex

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

45 kB

Total Files

26

Last publish

Collaborators

  • yiliang114