Sometimes, we want to access a method from another method with Vue.js.
In this article, we’ll look at how to access a method from another method with Vue.js.
How to access a method from another method with Vue.js?
To access a method from another method with Vue.js, we use this.
For instance, we write
<script>
export default {
//...
methods: {
methodA() {
// ...
},
methodB() {
this.methodA();
},
//...
},
};
</script>
to call methodA in methodB by using this.methodA().
Conclusion
To access a method from another method with Vue.js, we use this.