请问一下微信小程序延时函数如何调用自己定义的函数?

小程序 文章 2020-08-19 23:01 832 0 全屏看文

AI助手支持GPT4.0

请问一下微信小程序延时函数如何调用自己定义的函数?How does the WeChat applet delay function call the function defined by yourself?

请问一下微信小程序延时函数如何调用自己定义的函数?

在小程序开发中,我原本的想法是:Modelnoon是一个事件点击函数,当他执行时,第一步先执行TurnOffled这个函数,然后过秒再执行TurnOnCurtain这个函数

现在的话这么写 调试器报错 说我TurnOnCurtain没定义 实际上我定义了。

另外的话,我没用延时函数写了一种:

它正常运行 第一步关灯 然后第二步关窗帘 可是它运行完第一步后又把灯点亮了

In the development of small programs, my original idea is: modelnoon is an event click function. When it is executed, the first step is to execute the function of turnoff, and then execute the function of turnoncurtain in seconds. Now, the debugger reports that I have no definition of turnoncurtain, but I have defined it. In addition, I did not use the delay function to write one: it works normally, the first step is to turn off the light, then the second step is to close the curtain, but it turns on the light after the first step

回答:

stop eating:
 setTimeout(this.TurnOnCurtain, 300)  不加括号的
คℒ๓. ༗🍁:艾zug
Admin²⁰²⁰:
          let that= this;          setTimeout(() => {            that.TurnOnxxxx();          }, 2000);

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
微信小程序因为违规被永久封禁,其主体是否可以再申请小程序,不同的小程序会被牵连吗?
如何知道其它啊用户点击了转发分享的小卡片?
小程序审核成功发布后不更新?
内网穿透让小程序连接本地mysql, 是否可行?
顾客下单,但是没有信息提示,要在哪里设置?
随便看看
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9047
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7471
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6793
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 6127
如何解决渲染层网络错误Failed to load media? 17393