vue中实现methods⼀个⽅法调⽤另外⼀个⽅法
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⼀个⽅法调⽤另外⼀个⽅法就是⼩编分享给⼤家的全部内容了,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。