uvue.uts 551 B

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