|
@@ -60,17 +60,15 @@ Component({
|
|
|
lifetimes: {
|
|
|
attached() {
|
|
|
const rect = wx.getMenuButtonBoundingClientRect()
|
|
|
- wx.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- const isAndroid = res.platform === 'android'
|
|
|
- const isDevtools = res.platform === 'devtools'
|
|
|
- this.setData({
|
|
|
- ios: !isAndroid,
|
|
|
- innerPaddingRight: `padding-right: ${res.windowWidth - rect.left}px`,
|
|
|
- leftWidth: `width: ${res.windowWidth - rect.left }px`,
|
|
|
- safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${res.safeArea.top}px); padding-top: ${res.safeArea.top}px` : ``
|
|
|
- })
|
|
|
- }
|
|
|
+ const wxDeviceInfo = wx.getDeviceInfo()
|
|
|
+ const wxWindowInfo = wx.getWindowInfo()
|
|
|
+ const isAndroid = wxDeviceInfo.platform === 'android'
|
|
|
+ const isDevtools = wxDeviceInfo.platform === 'devtools'
|
|
|
+ this.setData({
|
|
|
+ ios: !isAndroid,
|
|
|
+ innerPaddingRight: `padding-right: ${wxWindowInfo.windowWidth - rect.left}px`,
|
|
|
+ leftWidth: `width: ${wxWindowInfo.windowWidth - rect.left }px`,
|
|
|
+ safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${wxWindowInfo.safeArea.top}px); padding-top: ${wxWindowInfo.safeArea.top}px` : ``
|
|
|
})
|
|
|
},
|
|
|
},
|