setInterval在华为P20失效
setLineTime(){ let _this = this ; let x = 0; let imgs = [ line1: 'https://img.cdn.zhaoshang800.com/img/2019/07/29/broker/04e17c4f-6f59-412f-995f-6b45a8adea60.png' , line2: 'https://img.cdn.zhaoshang800.com/img/2019/07/29/broker/b8f84cbf-d39f-4e08-9afe-1a5cb374cfb5.png' , line3: 'https://img.cdn.zhaoshang800.com/img/2019/07/29/broker/7b65a69f-4bb4-45bb-b088-124eb314a5fe.png' , ]; // console.log('setLineTime') timerLine = setInterval( function (){ x++; x = x % 3; _this.setData({ arrLine: imgs[x] }); // console.log(timerLine, 'timerLine') // console.log(_this.data.arrLine, 'arrLine') } , 1000) }, |
在开发者工具和ios上能打印出console.log(timerLine, ‘timerLine’)和console.log(_this.data.arrLine, ‘arrLine’)
在我的安卓手机就不执行setInterval的内部代码
1 回复