cxc-szcx-uniapp/uni_modules/lime-shared/getRect/uvue.uts

16 lines
551 B
Plaintext
Raw Normal View History

2024-09-14 02:26:50 +00:00
// @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();
})
}