When WeChat Mini Programs acquires node information, why is it sometimes there and sometimes it is empty?

Custom component life cycle res.height sometimes reports to null

ready: function () {

var that = this
var query = wx.createSelectorQuery().in(this)
query.select(".question").boundingClientRect(function (res) {
  that.setData({
    questionHeight: res.height
  })
}).exec()
// console.log(that.data.questionHeight)

}

Feb.27,2021

may be a loading lifecycle problem.
try writing under onShow ()


your console.log must be written into the callback function, otherwise console will be executed before boundingClientRect triggers the callback and setData.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-191d617-1a76c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-191d617-1a76c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?