以下情况是关于微信小程序,延时执行js函数的问题,如图所示~

fight:function(e){ that = this; that.setData({ buttondisabled: true, loading: true }), setTimeout(function () { that.setData({ buttondisplay: 'none', playerdisplay: 'block', }, 9000) }) }


汪汪一只猫
浏览 293回答 2
2回答

幕布斯7119047

fight:function(e){ &nbsp; &nbsp;that = this; &nbsp; &nbsp;that.setData({ &nbsp; &nbsp; &nbsp; buttondisabled: true, &nbsp; &nbsp; &nbsp; loading: true &nbsp; &nbsp;}); &nbsp; &nbsp; //<--这里是分号不是逗号 &nbsp; &nbsp;setTimeout(function(){ &nbsp; &nbsp; &nbsp; that.setData({ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;buttondisplay: 'none', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;playerdisplay: 'block' &nbsp; &nbsp; &nbsp; }) &nbsp; &nbsp; &nbsp; &nbsp;//这里的错误不太好描述,自己看了 &nbsp; &nbsp;}, 9000); }

慕运维8079593

setTimeout(function () {//要延时执行的代码}, 2000) //延迟时间 这里是2秒
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
JavaScript