Version: 1.3.42
Taro.createSelectorQuery()
返回一个 SelectorQuery 对象实例。可以在这个实例上使用 select 等方法选择节点,并使用 boundingClientRect 等方法选择需要查询的信息。
示例代码
import Taro from '@tarojs/taro'
const query = Taro.createSelectorQuery()
API支持度
API | 微信小程序 | H5 | React Native |
---|---|---|---|
Taro.createSelectorQuery | ✔️ | ✔️ | |
selectorQuery.in | ✔️ | ✔️ | |
selectorQuery.select | ✔️ | ✔️ | |
selectorQuery.selectAll | ✔️ | ✔️ | |
selectorQuery.selectViewport | ✔️ | ✔️ | |
nodesRef.boundingClientRect | ✔️ | ✔️ | |
nodesRef.scrollOffset | ✔️ | ✔️ | |
nodesRef.fields | ✔️ | ✔️ | |
selectorQuery.exec | ✔️ | ✔️ |