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

网友投稿 303 2023-02-18


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

vue在同一个组件内;

methods中的一个方法调用methods中的另外一个方法

可以在调用的时候  this.$options.methods.test2();

this.$optioBAiPfns.methods.tesBAiPft2();一个方法调用另外一个方法;

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的方法

}

}

})


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:在线文档接口api(在线接口对接文档)
下一篇:接口参数测试(接口测试结果)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~