my-uniapp-tools 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/system/index.ts +7 -7
package/package.json
CHANGED
package/src/system/index.ts
CHANGED
|
@@ -149,12 +149,12 @@ export const getStatusBarHeight = () => {
|
|
|
149
149
|
export const getMenuButtonBoundingClientRect = () => {
|
|
150
150
|
try {
|
|
151
151
|
const platform = getPlatform();
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
// 只有在小程序平台才执行getMenuButtonBoundingClientRect
|
|
154
154
|
if (platform === 'weixin' || platform === 'alipay') {
|
|
155
155
|
return uni.getMenuButtonBoundingClientRect();
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
// 非小程序平台返回null
|
|
159
159
|
return null;
|
|
160
160
|
} catch (error) {
|
|
@@ -173,7 +173,7 @@ export const getNavHeight = () => {
|
|
|
173
173
|
// 获取状态栏高度
|
|
174
174
|
const statusBarHeight = getStatusBarHeight();
|
|
175
175
|
const platform = getPlatform();
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
// 小程序平台:状态栏高度 + 菜单按钮高度
|
|
178
178
|
if (platform === 'weixin' || platform === 'alipay') {
|
|
179
179
|
const menuButtonInfo = getMenuButtonBoundingClientRect();
|
|
@@ -183,17 +183,17 @@ export const getNavHeight = () => {
|
|
|
183
183
|
return navHeight;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
|
|
187
187
|
// App和H5平台:使用默认导航栏高度
|
|
188
|
-
const defaultNavHeight =
|
|
188
|
+
const defaultNavHeight = 0; // 默认导航栏高度
|
|
189
189
|
const totalHeight = statusBarHeight + defaultNavHeight;
|
|
190
190
|
console.log(`🚀 ~ ${platform}平台导航栏高度:`, totalHeight);
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
return totalHeight;
|
|
193
193
|
} catch (error) {
|
|
194
194
|
console.error('获取导航栏高度失败:', error);
|
|
195
195
|
// 返回默认高度(状态栏高度 + 44px 默认导航栏高度)
|
|
196
|
-
return getStatusBarHeight() +
|
|
196
|
+
return getStatusBarHeight() + 0;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|