• Welcome to Baben's blog that year. I'm glad to meet you at the right age!
  • Due to the theme, the QQ login partner displays the default avatar in the comments. Please go to the personal center to upload the avatar again.

Applet components cannot obtain nodes using selectAll

Code Notes barben 4 years ago (2020-05-06) 3076 views 0 comments

Shocked! Encapsulates a component. What you get is an empty array using wx. createSelectorQuery(). selectAll(). boundingClientRect()!?

The solution was unexpected, which made me feel sad. When I learned it, I gasped and could not speak on the spot!

In the component, add .in(this) that will do

 const query = wx.createSelectorQuery().in(this); query.selectAll(".area-item").boundingClientRect((rect) => { console.log(rect); }).exec();


Eight blogs that year, we have been
If the author does not indicate that it is an original article, please indicate the link and source of this article for reprinting
Applet components cannot obtain nodes using selectAll- https://www.barben.cn/code/814.html
Like( two )
Post my comments
Cancel comment
expression Mapping Bold Strike through Center Italic

You need to bring your nickname and email with you in the review of Eight Books that year!

  • Nickname (required)
  • Email (required)
  • website