diff --git a/packages/uni-api/src/service/base/upx2px.ts b/packages/uni-api/src/service/base/upx2px.ts index 62505502cab..1e39cdd1c5f 100644 --- a/packages/uni-api/src/service/base/upx2px.ts +++ b/packages/uni-api/src/service/base/upx2px.ts @@ -16,7 +16,13 @@ let baseWidth = 375 let includeWidth = 750 function checkDeviceWidth() { - const { platform, pixelRatio, windowWidth } = getBaseSystemInfo() + const { windowWidth, pixelRatio, platform } = + __PLATFORM__ === 'mp-weixin' + ? Object.assign({}, wx.getWindowInfo(), { + platform: wx.getDeviceInfo().platform, + }) + : getBaseSystemInfo() + deviceWidth = windowWidth as number deviceDPR = pixelRatio as number isIOS = (platform as string) === 'ios' diff --git a/packages/uni-mp-core/src/api/locale.ts b/packages/uni-mp-core/src/api/locale.ts index 3009799d6a7..722828f19a5 100644 --- a/packages/uni-mp-core/src/api/locale.ts +++ b/packages/uni-mp-core/src/api/locale.ts @@ -7,7 +7,9 @@ export const getLocale: typeof uni.getLocale = () => { if (app && app.$vm) { return app.$vm.$locale } - return normalizeLocale(__GLOBAL__.getSystemInfoSync().language) || LOCALE_EN + return __PLATFORM__ === 'mp-weixin' + ? normalizeLocale(__GLOBAL__.getAppBaseInfo().language) || LOCALE_EN + : normalizeLocale(__GLOBAL__.getSystemInfoSync().language) || LOCALE_EN } export const setLocale: typeof uni.setLocale = (locale) => { diff --git a/packages/uni-mp-core/src/runtime/app.ts b/packages/uni-mp-core/src/runtime/app.ts index 95f4d060fef..dc17bebf73b 100644 --- a/packages/uni-mp-core/src/runtime/app.ts +++ b/packages/uni-mp-core/src/runtime/app.ts @@ -164,7 +164,9 @@ export function initAppLifecycle( function initLocale(appVm: ComponentPublicInstance) { const locale = ref( - normalizeLocale(__GLOBAL__.getSystemInfoSync().language) || LOCALE_EN + __PLATFORM__ === 'mp-weixin' + ? normalizeLocale(__GLOBAL__.getAppBaseInfo().language) || LOCALE_EN + : normalizeLocale(__GLOBAL__.getSystemInfoSync().language) || LOCALE_EN ) Object.defineProperty(appVm, '$locale', { get() {