Vuex Action Patcher (Adding Tools to Your Context)
Add tools to your Vuex action context
Motivation
I found making tools available to the Vuex action context could be handy for numerous reasons. The library is designed for you to pass the same toolset to all actions from within the context.
- add tools to all actions
- add tools to actions within registered modules
- keep consistent tooling across all actions
Install
npm install vuex-action-patcher --save
Usage
Use in a Vue App
Vue const tools = const store = state: name actions: { console } plugins: tools el: '#app' store
Use with Dynamic Modules
main.js
Vue const tools = const store = plugins: tools el: '#app' store
later.js
store
Use in a Nuxt App
Under
store/index.js
const vuexActionPatch = const createStore = { return counter: 0 mutations: { statecounter++ } actions: { console } plugins: vuexActionPatch }