fix: 修复导航栏内容高度计算问题

This commit is contained in:
Ray.Hao
2026-03-06 15:57:48 +08:00
parent da47f98fe9
commit deef7b1b5b
2 changed files with 7 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
backgroundColor: bgColor,
}"
>
<view class="custom-navbar__content" :style="{ height: navBarHeight + 'px' }">
<view class="custom-navbar__content" :style="{ height: contentHeight + 'px' }">
<view class="custom-navbar__left" :style="{ width: leftWidth + 'px' }">
<view v-if="showBack" class="custom-navbar__back" @click="handleBack">
<wd-icon :name="backIcon" :size="backIconSize" :color="iconColor" />
@@ -82,6 +82,11 @@ const statusBarHeight = computed(() => navbar.statusBarHeight.value);
const navBarHeight = computed(() => navbar.navBarHeight);
const totalHeight = computed(() => navbar.totalHeight.value);
const contentHeight = computed(() => {
const height = totalHeight.value - statusBarHeight.value;
return height > 0 ? height : navBarHeight.value;
});
const menuButtonWidth = computed(() => navbar.menuButtonWidth.value);
const menuButtonRightGap = computed(() => navbar.menuButtonRightGap.value);
const menuButtonLeft = computed(() => navbar.menuButtonLeft.value);

View File

@@ -1,6 +1,6 @@
<template>
<view class="home-page">
<custom-navbar title="首页" fixed placeholder>
<custom-navbar title="首页" fixed placeholder :showBack="false">
<template #right>
<wd-search
v-model="searchValue"