主要更新uniapp相关功能
This commit is contained in:
1 parent
aa92ca40a2
commit
5b4dbb2b46
65 files changed
+8532
-1921
No files matched your search
@@ -0,0 +1,17 @@
|
||||
// 小程序自定义导航头部避让工具
|
||||
// env(safe-area-inset-top) 在开发者工具模拟器/部分安卓机返回 0,不可靠;
|
||||
// 改用胶囊按钮实测位置(getMenuButtonBoundingClientRect)计算顶部内边距。
|
||||
// 用法:const headPad = mpHeadPad(),绑定到头部元素 :style="headPad"
|
||||
export function mpHeadPad(extra = 8) {
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
const mb = uni.getMenuButtonBoundingClientRect()
|
||||
if (mb && mb.bottom > 0) {
|
||||
return { paddingTop: mb.bottom + extra + 'px' }
|
||||
}
|
||||
} catch (e) {
|
||||
// 取不到胶囊时回退 CSS 值
|
||||
}
|
||||
// #endif
|
||||
return {}
|
||||
}
|
||||
Reference in new issue
Block a user