Skip to content

Commit

Permalink
fix(mp-weixin): 兼容旧版本的 getWindowInfo,getDeviceInfo,getAppBaseInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
GRCmade committed Jan 13, 2025
1 parent 5eb2d5f commit 38ae52e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/uni-mp-weixin/src/api/shims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ export function createSelectorQuery() {
}

const wx = initWx()

if (!__GLOBAL__.canIUse('getAppBaseInfo')) {
__GLOBAL__.getAppBaseInfo = __GLOBAL__.getSystemInfoSync
}

if (!__GLOBAL__.canIUse('getWindowInfo')) {
__GLOBAL__.getWindowInfo = __GLOBAL__.getSystemInfoSync
}

if (!__GLOBAL__.canIUse('getDeviceInfo')) {
__GLOBAL__.getDeviceInfo = __GLOBAL__.getSystemInfoSync
}

let baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo()
if (!baseInfo) {
baseInfo = wx.getSystemInfoSync()
Expand Down

0 comments on commit 38ae52e

Please sign in to comment.