Skip to content

Commit 94edbff

Browse files
committed
wip(x): 小红书不支持 getWindowInfo
1 parent 4cc8320 commit 94edbff

File tree

1 file changed

+3
-3
lines changed
  • packages/uni-mp-core/src/runtime

1 file changed

+3
-3
lines changed

packages/uni-mp-core/src/runtime/page.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,19 @@ export function initPageInstance(mpPageInstance: MPComponentInstance) {
8888
if (__X__) {
8989
Object.assign(mpPageInstance, {
9090
get width(): number {
91-
if (__PLATFORM__ === 'mp-toutiao') {
91+
if (__PLATFORM__ === 'mp-toutiao' || __PLATFORM__ === 'mp-xhs') {
9292
return __GLOBAL__.getSystemInfoSync().windowWidth
9393
}
9494
return __GLOBAL__.getWindowInfo().windowWidth
9595
},
9696
get height(): number {
9797
const windowInfo = __GLOBAL__.getWindowInfo()
9898
// 某些版本的微信小程序开发工具获取tabBar页面的screenTop不对,其数值包含了tabBar高度及底部安全区,如果有开发者问起让他使用真机测试即可。
99-
// TODO 抖音小程序没有 getWindowInfo 方法,暂时无法获取 screenTop
99+
// TODO 抖音小程序、小红书小程序没有 getWindowInfo 方法,暂时无法获取 screenTop
100100
return windowInfo.windowHeight + windowInfo.screenTop
101101
},
102102
get statusBarHeight(): number {
103-
if (__PLATFORM__ === 'mp-toutiao') {
103+
if (__PLATFORM__ === 'mp-toutiao' || __PLATFORM__ === 'mp-xhs') {
104104
return __GLOBAL__.getSystemInfoSync().statusBarHeight
105105
}
106106
return __GLOBAL__.getWindowInfo().statusBarHeight

0 commit comments

Comments
 (0)