I have some variables
data() {
return {
resData: {},
datData: {},
.....
};
},
then I have method that need to assign values to resData and etc.
If name has value of resData then I need to assign value to the variable.
methods:{
chgValue(name){
if (name == 'resData') this.resData = 1;
elseif .....
else
}
}
Instead of doing multiple if else statements, I'm trying to do something:
methods:{
chgValue(name){
this.window[name] = 1;
}
}
But I receive error
TypeError: Cannot set property 'resData' of undefined
Any ways that i could achieve the method ?