[Vuejs]-Call nested method in vuejs

0👍

Without exactly seeing what thirdlib is, this happens because thirdLib.debounce() creates a debounce method, it doesn’t execute it. So in your first example, where are you executing it? You’re not you just declare it and throw it away. But because you want the same debounce instance to be called every time (that’s how it knows to debounce), I don’t even think the first example would work as a debounce if you did get it to execute because every call would create a new debounce instance.

So this is really more of a Javascript thing and less of a vue thing.

0👍

it is because you need a callback as params for thirdLib.debound. The code you showed here actually define a callback with two parameters, you called it the same name param1, param2.

You just need to write another method as

method3: thirdLib.debound(param1, param2)....
Then you pass it as

method1: function(param1, param2){
// I can log param1 in here
this.method3(param1, param2);
}

Leave a comment