收藏
回答

query.select(..).boundingClientRect().exec()回调不触发?

var query = wx.createSelectorQuery().in(this);

query.select('.smart-scrolll').boundingClientRect(res => {

if (!res){

console.log("11111111111111111111");

return;

}

console.log("222222222222222222222222222");

var windowInfo = wx.getWindowInfo ?wx.getWindowInfo() : {windowHeight: wx.getSystemInfoSync().windowHeight};// 获取窗口信息(兼容新旧API)

var availableHeight = windowInfo.windowHeight - res.top;// 最终高度计算

this.setData({

scrollHeight: availableHeight

});

}).exec();以上是一个自定义组件中的js代码,console.log("11111111111111111111")和console.log("222222222222222222222222222")均不执行,是什么原因?

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

1 个回答

  • showms
    showms
    03-04

    是在自定义组件里面执行的吗

    03-04
    有用
    回复 1
    • 果果
      果果
      03-11
      是的
      03-11
      回复
登录 后发表内容