Skip to content

Commit

Permalink
fix(alipay): getBoundingClientRect在alipay上的实现兼容 (#17386)
Browse files Browse the repository at this point in the history
Co-authored-by: Shijie Yu <yushijiechn@qq.com>
  • Loading branch information
StepToTop and tutuxxx authored Feb 28, 2025
1 parent bed1b6b commit f180604
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/taro-runtime/src/dom-external/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ export function getBoundingClientRectImpl (this: TaroElement): Promise<null> {
if (!options.miniGlobal) return Promise.resolve(null)
return new Promise(resolve => {
const query = options.miniGlobal.createSelectorQuery()
// ref: https://opendocs.alipay.com/mini/api/na4yun
if (process.env.TARO_ENV === 'alipay') {
query.select(`#${this.uid}`).boundingClientRect().exec(res => {
resolve(res)
})
return
}

query.select(`#${this.uid}`).boundingClientRect(res => {
resolve(res)
}).exec()
Expand Down

0 comments on commit f180604

Please sign in to comment.