web
9 小时以前 49fa0d82a40345342966e810b44429aec0480ef3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// @ts-nocheck
export function getRect(selector : string, context: ComponentInternalInstance):Promise<NodeInfo> {
    return new Promise((resolve)=>{
        uni.createSelectorQuery().in(context).select(selector).boundingClientRect(res =>{
            resolve(res as NodeInfo)
        }).exec();
    })
}
 
export function getAllRect(selector : string, context: ComponentInternalInstance):Promise<NodeInfo[]> {
    return new Promise((resolve)=>{
        uni.createSelectorQuery().in(context).selectAll(selector).boundingClientRect(res =>{
            resolve(res as NodeInfo[])
        }).exec();
    })
}