收藏
回答

远程调试太卡

框架类型 问题类型 操作系统 操作系统版本 手机型号 微信版本
小程序 Bug iOS win7 iphone8 6.7.1

这个手机版本循环获取 wx.createSelectorQuery() 的坐标总是有延迟 调试太慢有什么办法解决吗


回答关注问题邀请回答
收藏

2 个回答

  • 一切随风
    一切随风
    2018-08-15

    setTimeout(function() {

    wx.createSelectorQuery().select('#view-pointer').boundingClientRect(function(rect) {

    if (rect.top <= that.data.h5 + w4) {

    wx.createSelectorQuery().select('#view-id1').boundingClientRect(function(rect2) {

    if (rect2.left + w4 >= left && rect2.left <= left + w6) {

    var score = 20;

    that.setData({

    hidebg1: true,

    left1: rect2.left,

    score: that.data.score + score,

    })

    //音乐

    that.myAudiocock.seek(0);

    that.myAudiocock.play();


    setTimeout(function() {

    that.animationcapture1.translateY(height - that.data.w5 - that.data.h7).step()

    that.animationpointer.height(0).step()

    that.animationadd.opacity(1).translateY(-15).step()

    that.setData({

    animationcapture1: that.animationcapture1.export(),

    animationpointer: that.animationpointer.export(),

    animationadd: that.animationadd.export(),

    })

    isok = false;

    setTimeout(function() {

    that.animationcapture1.translateY(0).step()

    that.animationadd.opacity(0).translateY(0).step()

    that.setData({

    hidebg1: false,

    animationcapture1: that.animationcapture1.export(),

    animationadd: that.animationadd.export(),

    })

    }, 300)

    }, 60)

    } else {

    setTimeout(that.getRect, ot1);

    }

    }).exec()

    } else if (rect.top <= h6 + w4 && rect.top >= h6) {

    wx.createSelectorQuery().select('#view-id2').boundingClientRect(function(rect1) {

    if (rect1.left + w4 >= left && rect1.left < left + w6) {

    //音乐

    that.myAudiobomb.seek(0);

    that.myAudiobomb.play();


    that.setData({

    hidebg2: true,

    left2: rect1.left,

    score: that.data.score - 10,

    errornum: 0,

    })

    setTimeout(function() {

    that.erroranimation();

    that.animationpointer.height(0).step()

    that.animationreduce.opacity(1).translateY(-15).step()

    that.setData({

    animationpointer: that.animationpointer.export(),

    animationreduce: that.animationreduce.export(),

    })

    isok = false;

    setTimeout(function() {

    that.animationreduce.opacity(0).translateY(0).step()

    that.setData({

    animationreduce: that.animationreduce.export(),

    })

    }, 300)

    }, 60)

    } else {

    setTimeout(that.getRect, ot1);

    }

    }).exec()

    } else {

    setTimeout(that.getRect, ot1);

    }

    }).exec()

    }, 2)


    2018-08-15
    有用
    回复
  • 灵芝
    灵芝
    2018-08-15

    你好,请提供出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2018-08-15
    有用
    回复
登录 后发表内容