自丢网

标题: 微信小程序methods中定义的方法互相调用的实例代码 [打印本页]

作者: admin    时间: 2020-9-10 08:49
标题: 微信小程序methods中定义的方法互相调用的实例代码
当调用test2时: methods = { test(age){ console.log('test', age); },
当调用test2时:
  1. methods = {
  2.     test(age){
  3.       console.log('test', age);
  4.     },
  5.     test2(){
  6.       console.log(this.methods);
  7.       this.methods.test('222');
  8.       console.log('test2')
  9.     }
  10.   };
复制代码
运行结果:
  1. {test: f, test2: f}
  2. test 222
  3. test2
复制代码
总结
以上所述是小编给大家介绍的微信小程序methods中定义的方法互相调用的实例代码,希望对大家有所帮助。






欢迎光临 自丢网 (https://www.zidiu.com/) Powered by Discuz! X3.5