1.2.6 • Published 6 years ago

vuex-multi-commit v1.2.6

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

vuex-multi-commit

npm npm

This package allows to combine code needed to commit multiple mutations inside one commit call.

Installation

  import Vuex from 'vuex'
  import 'vuex-multi-commit'

  Vue.use(Vuex)

For NUXT import this package inside main store module or inside store.js file

Usage

Instead of:

  this.$store.commit('doThis')
  this.$store.commit('doThat')

You can write:

  this.$store.commit(['doThis', 'doThat'])

Instead of this:

  this.$store.commit('doThis')
  this.$store.commit('doThat', 200300)
  this.$store.commit('andDoThis', 300600)
  this.$store.commit('andAlsoDoThat', 400700)

You can do:

  this.$store.commit([
    'doThis',
    {
      'doThat': 200300,
      'andDoThis': 300600,
      'andAlsoDoThat': 400700
    }
  ])

If you want, you can use single object:

  this.$store.commit({
    'doThis': 100500,
    'doThat': 200300,
    'andDoThis': 300600,
    'andAlsoDoThat': 400700
  })

Unfortunately, so far this package doesn't allow to use arrays or objects inside store modules except root.

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago