case 1
data(){
return {
serverNames : ['local']
}
}
computed: {
...mapState('store', {
local_server_name: (state) => {
this.serverNames[0] = state.local_server_name // Cannot read property 'serverNames' of undefined
return state.local_server_name
},
}),
},
case 2
computed: {
...mapState('store', {
local_server_name: (state) => {
serverNames[0] = state.local_server_name // serverNames is not defined
return state.local_server_name
},
}),
},
In fact, appending this or not, it doesn't work. If I want to use arrow function, then how to get that serverNames
array?