收藏
回答

使用onPullDownRefresh下拉刷新时候列表卡顿?

    此处为我的代码,但是在ios上明显的卡顿,并且无法滑动列表

onPullDownRefresh() {

// wx.showNavigationBarLoading() //在标题栏中显示加载

let that = this;

that.shuaxin();

},


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

1 个回答

  • 阿客
    阿客
    2019-08-17

    shuaxin();里面是什么?贴出来看看。

    2019-08-17
    有用
    回复 2
    • .
      .
      2019-08-17
      let loginData = app.getCache('loginData') const that = this const openid = app.getCache('openid') // 未登录 if (loginData == null || loginData == "") { that.setData({ delayed: true }) } else { // 已登录 core.Post('getMyDeviceInfo', { uhomeToken: loginData.uhome_access_token, openId: openid, uhomeUserId: loginData.uhome_user_id }, function (ret) { let wifitype_arr = that.data.getWifiType let ret_info = ret.data.data.info let new_arr = [] //循环获取列表数据 ret_info.forEach(i => { wifitype_arr.forEach(j => { if (i.wifiType === j.wifiType) { i['status'] = j.deviceType that.data.shuzu.push(i) } }) }) // console.log(that.data.shuzu, 'that.data.shuzu') // for (let e in ref.data.data) { // for (let f in ret.data.data.info) { // //判断wifitype相等赋值大类 // if (ref.data.data[e].wifiType == ret.data.data.info[f].wifiType) { // ret.data.data.info[f].status = ref.data.data[e].deviceType // //存储数据 // that.setData({ // shuzu: ret.data.data // }) setTimeout(function () { that.setData({ delayed: true }) }, 100) // } // } // } //获取设备大类信息 core.Post('getDeviceType', {}, function (reh) { if (reh.data.code == '0000') { var info = that.data.shuzu // console.log(info) let abc = [] for (let a in info) { abc.push(info[a].status) } //此判断是用来判断显示设备列表页面还是全屋用水页面,判断条件为当用户绑定的设备里包含了电热水器+净水器或者燃气热水器+净水器这两种条件就显示全屋用水,不满足这两种条件中的一种就显示设备列表 if (abc.indexOf(reh.data.data[0].id) > 0 && abc.indexOf(reh.data.data[4].id) > 0 || abc.indexOf(reh.data.data[1].id) > 0 && abc.indexOf(reh.data.data[4].id) > 0) { that.setData({ status: 2, //状态码为1显示全屋用水页面 pageTitle: '设备列表' }) } else { that.setData({ status: 2, //状态码为2显示设备列表页面 pageTitle: '设备列表' }) } that.setData({ Largeclass: reh.data.data }) } })
      2019-08-17
      回复
    • 阿客
      阿客
      2019-08-18回复.
      (1)request是异步的,不要提前 setData
      2019-08-18
      回复
登录 后发表内容
问题标签