vue的method函数互引用_vue 在methods中调用mounted的实现操作

vue 在methods中调用mounted的实现操作

首先可以在data中先声明一个变量

比如 sureDelBox : ' '

mounted 中 --->

methods 中 ---> this.sureDelBox(item) 直接this调用

这时候要传的参数别忘记带上

如果你要问在mounted中调用methods中的方法

那么如果是我 我会直接把这个方法直接写在mounted中

补充知识: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();

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值