84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
import {INCREMENT} from "./types" const mutations = { [INCREMENT] (state) { state.count++; } }
[INCREMENT] Can't INCREMENT be used directly as a variable? Why do we need to add a bracket?
[INCREMENT]
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
[INCREMENT]是计算INCREMENT这个变量的值作为函数名,不使用中括号是把INCREMENTThis string is used as the function name.
INCREMENT
const INCREMENT = 'myfunc'; const mutations = { [INCREMENT] (state) { state.count++; } }
Equivalent to the above code, the result is
const mutations = { myfunc(state) { state.count++; } }
And
const INCREMENT = 'myfunc'; const mutations = { INCREMENT (state) { state.count++; } }
is
const mutations = { INCREMENT(state) { state.count++; } }
These are computed property names
https://developer.mozilla.org...
[INCREMENT]
是计算INCREMENT
这个变量的值作为函数名,不使用中括号是把INCREMENT
This string is used as the function name.Equivalent to the above code, the result is
And
The result ofis
These are computed property names
https://developer.mozilla.org...