13. Calling method dynamically through variables in vuejs
===========================================
In Javascript, if you are an object like this :
const foo = {
To call this "dynamicly" you should type
foo['bar']()
So, in your case, instead of :
this.[type]()
You should type :
##Reference : https://stackoverflow.com/questions/48284354/calling-method-dynamically-through-variables-in-vuejs
===========================================
In Javascript, if you are an object like this :
const foo = {
bar() {},
baz() {}
};
To call this "dynamicly" you should type
foo['bar']()
foo['baz']()
So, in your case, instead of :this.[type]()
You should type :
this[type]()
##Reference : https://stackoverflow.com/questions/48284354/calling-method-dynamically-through-variables-in-vuejs
Comments
Post a Comment