SelectorQuery

解释: 选择器

selectorQuery对象的方法列表 :

示例

跳转编辑工具

在开发者工具中打开

在 WEB IDE 中打开

扫码体验

代码示例

百度智能小程序

请使用百度APP扫码

图片示例

SelectorQuery - 图2

代码示例

  • JS
  1. Page({
  2. onReady() {
  3. this.selectorQuery = swan.createSelectorQuery();
  4. },
  5. queryNodeInfo() {
  6. this.selectorQuery
  7. // .in(this); 用于自定义组件内加此语句
  8. .select('.target')
  9. // 或者.selectAll('.target')
  10. // 或者.selectViewport()
  11. .boundingClientRect()
  12. .exec(res => {
  13. console.log('节点信息', res);
  14. })
  15. }
  16. });