Skip to main content
Version: 1.x

Taro.createSelectorQuery()

返回一个 SelectorQuery 对象实例。可以在这个实例上使用 select 等方法选择节点,并使用 boundingClientRect 等方法选择需要查询的信息。

示例代码

import Taro from '@tarojs/taro'

const query = Taro.createSelectorQuery()

API支持度

API微信小程序H5React Native
Taro.createSelectorQuery✔️✔️
selectorQuery.in✔️✔️
selectorQuery.select✔️✔️
selectorQuery.selectAll✔️✔️
selectorQuery.selectViewport✔️✔️
nodesRef.boundingClientRect✔️✔️
nodesRef.scrollOffset✔️✔️
nodesRef.fields✔️✔️
selectorQuery.exec✔️✔️