Home >Web Front-end >JS Tutorial >How to implement calling between methods in vue
Below I will share with you an article about how to implement methods in Vue. One method calls another method. It has a good reference value and I hope it will be helpful to everyone.
vue is in the same component;
A method in methods calls another method in methods
can be called when this. $options.methods.test2();
##this.$options.methods.test2();One method calls another method ;
new Vue({ el: '#app', data: { test:111, }, methods: { test1:function(){ alert(this.test) }, test2:function(){ alert("this is test2") alert(this.test) //test3调用时弹出undefined }, test3:function(){ this.$options.methods.test2();//在test3中调用test2的方法 } } })The above is what I compiled for everyone. I hope it will be helpful to everyone in the future. Related articles:
Use ref in vue to let the parent component call the child component
How to realize the web front-end page generation exe
How to implement ajax front-end and back-end cross-domain requests
The above is the detailed content of How to implement calling between methods in vue. For more information, please follow other related articles on the PHP Chinese website!