feat:小程序修改
This commit is contained in:
1 parent
6412d3be5c
commit
0398148db7
8 files changed
+73
-41
No files matched your search
@@ -11,17 +11,29 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
})
|
||||
|
||||
function getHeight() {
|
||||
const { top, bottom } = uni.getSystemInfoSync().safeAreaInsets!
|
||||
let _statusBarHeight = 0;
|
||||
let _bottom = 0;
|
||||
const { statusBarHeight, safeAreaInsets } = uni.getSystemInfoSync()
|
||||
const { bottom = 0 } = safeAreaInsets ?? {}
|
||||
if (statusBarHeight) {
|
||||
_statusBarHeight = statusBarHeight
|
||||
}
|
||||
if (_statusBarHeight <= 20) {
|
||||
_statusBarHeight = 20
|
||||
}
|
||||
if (bottom) {
|
||||
_bottom = bottom
|
||||
}
|
||||
if (_bottom <= 8) {
|
||||
_bottom = 8
|
||||
}
|
||||
if (props.type && props.type === "bottom") {
|
||||
return bottom + "px"
|
||||
return _bottom + "px"
|
||||
}
|
||||
if (props.type && props.type === "top") {
|
||||
if (top < 22) {
|
||||
return "22px"
|
||||
}
|
||||
return top + "px"
|
||||
return _statusBarHeight + "px"
|
||||
}
|
||||
return 22 + "px"
|
||||
return 20 + "px"
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user