状态栏调整

This commit is contained in:
shikong 2024-10-17 20:20:17 +08:00
parent 77ff420f02
commit 376480c729
Signed by: Shikong
GPG Key ID: BD85FF18B373C341

View File

@ -16,12 +16,12 @@ const ctx = reactive({
let capsule = uni.getMenuButtonBoundingClientRect(); //
let system = uni.getSystemInfoSync(); //
let {safeAreaInsets} = system
console.log(system, safeAreaInsets)
ctx.safeAreaInsets = safeAreaInsets
ctx.safeAreaInsets = safeAreaInsets
ctx.navHeight = system.statusBarHeight + capsule.height; //
ctx.statusBarHeight = system.statusBarHeight //
ctx.capsuleWidth = capsule.width; //
console.log(system, safeAreaInsets)
function searchKeyword() {
console.log(ctx.search.keyword)
@ -35,7 +35,7 @@ function searchKeyword() {
</script>
<template>
<view :style="{paddingTop: ctx.safeAreaInsets.top + 'px', paddingRight: ctx.capsuleWidth + 'px'}" style="background: #1296db">
<view :style="{paddingTop: (ctx.safeAreaInsets.top || ctx.statusBarHeight) + 'px', paddingRight: ctx.capsuleWidth + 'px'}" style="background: #1296db">
<uni-search-bar v-model="ctx.search.keyword" bgColor="#EEEEEE" placeholder="请输入搜索内容" @confirm="searchKeyword" cancelButton="none"></uni-search-bar>
</view>
</template>