vue在同一個組件內;
methods中的一個方法調用methods中的另外一個方法
可以在調用的時候 this.$options.methods.test2();
this.$options.methods.test2();一個方法調用另外一個方法;
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的方法 } } }) 以上這篇vue中實現methods一個方法調用另外一個方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。
新聞熱點
疑難解答