I\'d like to group some of my Vue.js methods together in a sort of \"submethod\" class, but I only seem to be able to have single level methods.
For example, if I wanted
if i had that problem, i would use a click handler() to delegate request to other methods. eg:
new Vue({
el: '#app',
data: { },
methods: {
handler1: function() {
console.log("handler 1 called");
},
handler2: function() {
console.log("handler 2 called");
},
buttonHandler:function(callback){
callback();
}
}
});
and use html as
The code is only for demo. In real life i will be passing a number or string argument in template and using switch case to determine handler.