-
Installation | Vuex
Centralized State Management for Vue.js
-
Getting Started | Vuex
store. A "store" is basically a container that holds your application
state. There are two things that make a Vuex store different from a plain global object:
Vuex stores are reactive. When Vue compo...
-
Actions | Vuex
store.dispatch method:
store.dispatch('increment')
This may look silly at first sight: if we want to increment the count, why don't we just call
store.commit('increment') directly? Remember that
mu...
-
Application Structure | Vuex
Vuex doesn't really restrict how you structure your code. Rather, it enforces a set of high-level principles:
Application-level state is centralized in the store.
The only way to mutate the state is b...
-
Modules | Vuex
To help with that, Vuex allows us to divide our store into
modules. Each module can contain its own state, mutations, actions, getters, and even nested modules - it's fractal all the way down:
const ...
-
Form Handling | Vuex
// ...
computed: {
...mapState({
message: state => state.obj.message
})
},
methods: {
updateMessage (e) {
this.$store.commit('updateMessage', e.target.value)
}
}
And here's the mutati...