I wonder why mutation values ββare used in "[]"
in Vuex.
What does the code like ""
mean?
export const SOME_MUTATION = 'SOME_MUTATION'
Is it just a constant name for the function? If so, I wonder why the constant is written in "[]"
.
Also, when used in the computed or method property, I wonder why you would pass the following code as ["SOME_ACTION"]
instead of "SOME_ACTION"
.
...mapActions(["SOME_ACTION"]),
exam code
export const SOME_MUTATION = 'SOME_MUTATION'
import Vuex from 'vuex'
import { SOME_MUTATION } from './mutation-types'
const store = new Vuex.Store({
state: { ... },
mutations: {
[SOME_MUTATION] (state) {
}
}
})