File tree 1 file changed +26
-0
lines changed
packages/uni-mp-core/src/runtime
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,32 @@ export function initPageInstance(mpPageInstance: MPComponentInstance) {
97
97
get statusBarHeight ( ) : number {
98
98
return __GLOBAL__ . getWindowInfo ( ) . statusBarHeight
99
99
} ,
100
+ get safeAreaInsets ( ) {
101
+ const windowInfo = __GLOBAL__ . getWindowInfo ( )
102
+ const screenBottom =
103
+ windowInfo . screenHeight -
104
+ windowInfo . screenTop -
105
+ windowInfo . windowHeight
106
+ const safeAreaBottom =
107
+ windowInfo . screenHeight - windowInfo . safeArea . bottom
108
+ return {
109
+ top : Math . max ( 0 , windowInfo . statusBarHeight - windowInfo . screenTop ) ,
110
+ left : 0 ,
111
+ right : 0 ,
112
+ bottom : Math . max ( 0 , safeAreaBottom - screenBottom ) , // 无法计算,
113
+ }
114
+ } ,
115
+ get pageBody ( ) {
116
+ const windowInfo = __GLOBAL__ . getWindowInfo ( )
117
+ return {
118
+ top : windowInfo . screenTop ,
119
+ left : 0 ,
120
+ right : windowInfo . windowWidth ,
121
+ bottom : windowInfo . windowHeight + windowInfo . screenTop ,
122
+ width : windowInfo . windowWidth ,
123
+ height : windowInfo . windowHeight ,
124
+ }
125
+ } ,
100
126
} )
101
127
}
102
128
}
You can’t perform that action at this time.
0 commit comments