I\'m using VueJS to make a simple enough resource management game/interface. At the minute I\'m looking to activate the roll
function every 12.5 seconds and use
You can access these methods directly on the VM instance, or use them in directive expressions. All methods will have their
this
context automatically bound to the Vue instance.
– Vue API Guide on methods
Within a method on a Vue instance you can access other methods on the instance using this
.
var vm = new Vue({
...
methods: {
methodA() {
// Method A
},
methodB() {
// Method B
// Call `methodA` from inside `methodB`
this.methodA()
},
},
...
});
To access a method outside of a Vue instance you can assign the instance to a variable (such as vm
in the example above) and call the method:
vm.methodA();