您好,欢迎来到九壹网。
搜索
您的当前位置:首页vue中实现methods一个方法调用另外一个方法

vue中实现methods一个方法调用另外一个方法

来源:九壹网
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⼀个⽅法调⽤另外⼀个⽅法就是⼩编分享给⼤家的全部内容了,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 91gzw.com 版权所有 湘ICP备2023023988号-2

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务