fix(布局): 调整底部导航栏样式以适应安全区域
调整底部导航栏高度和间距以兼容不同设备的底部安全区域 重构导航图标布局,统一尺寸并优化居中效果 更新阴影样式和文字大小提升视觉一致性
Showing
2 changed files
with
38 additions
and
22 deletions
| 1 | <template> | 1 | <template> |
| 2 | <view class="index-nav" :class="[`is-${position}`]"> | 2 | <view class="index-nav" :class="[`is-${position}`]"> |
| 3 | - <view class="nav-logo" :class="{ 'is-active': active === 'home' }" @tap="() => on_select('home')"> | 3 | + <view class="nav-logo is-home" :class="{ 'is-active': active === 'home' }" @tap="() => on_select('home')"> |
| 4 | + <view class="nav-icon-wrap"> | ||
| 4 | <image class="nav-icon" :src="icons?.home" mode="aspectFit" /> | 5 | <image class="nav-icon" :src="icons?.home" mode="aspectFit" /> |
| 6 | + </view> | ||
| 5 | <text class="nav-text">首页</text> | 7 | <text class="nav-text">首页</text> |
| 6 | </view> | 8 | </view> |
| 7 | 9 | ||
| 8 | <view | 10 | <view |
| 9 | - class="nav-logo" | 11 | + class="nav-logo is-code" |
| 10 | :class="[{ 'is-active': active === 'code' }, { 'is-center-raised': center_variant === 'raised' }]" | 12 | :class="[{ 'is-active': active === 'code' }, { 'is-center-raised': center_variant === 'raised' }]" |
| 11 | @tap="() => on_select('code')" | 13 | @tap="() => on_select('code')" |
| 12 | > | 14 | > |
| 15 | + <view class="nav-icon-wrap"> | ||
| 13 | <image | 16 | <image |
| 14 | class="nav-icon" | 17 | class="nav-icon" |
| 15 | :class="{ 'nav-icon--raised': center_variant === 'raised' }" | 18 | :class="{ 'nav-icon--raised': center_variant === 'raised' }" |
| 16 | :src="icons?.code" | 19 | :src="icons?.code" |
| 17 | mode="aspectFit" | 20 | mode="aspectFit" |
| 18 | /> | 21 | /> |
| 19 | - <view v-if="center_variant === 'raised'" class="nav-icon-placeholder"></view> | 22 | + </view> |
| 20 | <text class="nav-text">预约码</text> | 23 | <text class="nav-text">预约码</text> |
| 21 | </view> | 24 | </view> |
| 22 | 25 | ||
| 23 | - <view class="nav-logo" :class="{ 'is-active': active === 'me' }" @tap="() => on_select('me')"> | 26 | + <view class="nav-logo is-me" :class="{ 'is-active': active === 'me' }" @tap="() => on_select('me')"> |
| 27 | + <view class="nav-icon-wrap"> | ||
| 24 | <image class="nav-icon" :src="icons?.me" mode="aspectFit" /> | 28 | <image class="nav-icon" :src="icons?.me" mode="aspectFit" /> |
| 29 | + </view> | ||
| 25 | <text class="nav-text">我的</text> | 30 | <text class="nav-text">我的</text> |
| 26 | </view> | 31 | </view> |
| 27 | </view> | 32 | </view> |
| ... | @@ -64,11 +69,15 @@ const on_select = (key) => { | ... | @@ -64,11 +69,15 @@ const on_select = (key) => { |
| 64 | left: 0; | 69 | left: 0; |
| 65 | bottom: 0; | 70 | bottom: 0; |
| 66 | width: 750rpx; | 71 | width: 750rpx; |
| 67 | - height: 134rpx; | 72 | + height: calc(134rpx + constant(safe-area-inset-bottom)); |
| 73 | + height: calc(134rpx + env(safe-area-inset-bottom)); | ||
| 74 | + padding-bottom: calc(0rpx + constant(safe-area-inset-bottom)); | ||
| 75 | + padding-bottom: calc(0rpx + env(safe-area-inset-bottom)); | ||
| 76 | + box-sizing: border-box; | ||
| 68 | background: #FFFFFF; | 77 | background: #FFFFFF; |
| 69 | - box-shadow: 0 -10rpx 8rpx 0 rgba(0, 0, 0, 0.12); | 78 | + box-shadow: 0 -8rpx 8rpx 0 rgba(0, 0, 0, 0.1); |
| 70 | display: flex; | 79 | display: flex; |
| 71 | - align-items: center; | 80 | + align-items: flex-end; |
| 72 | justify-content: space-around; | 81 | justify-content: space-around; |
| 73 | color: #A67939; | 82 | color: #A67939; |
| 74 | z-index: 99; | 83 | z-index: 99; |
| ... | @@ -88,14 +97,23 @@ const on_select = (key) => { | ... | @@ -88,14 +97,23 @@ const on_select = (key) => { |
| 88 | align-items: center; | 97 | align-items: center; |
| 89 | } | 98 | } |
| 90 | 99 | ||
| 100 | + .nav-icon-wrap { | ||
| 101 | + position: relative; | ||
| 102 | + width: 56rpx; | ||
| 103 | + height: 56rpx; | ||
| 104 | + display: flex; | ||
| 105 | + align-items: center; | ||
| 106 | + justify-content: center; | ||
| 107 | + } | ||
| 108 | + | ||
| 91 | .nav-icon { | 109 | .nav-icon { |
| 92 | - width: 48rpx; | 110 | + width: 56rpx; |
| 93 | - height: 48rpx; | 111 | + height: 56rpx; |
| 94 | display: block; | 112 | display: block; |
| 95 | 113 | ||
| 96 | &.nav-icon--raised { | 114 | &.nav-icon--raised { |
| 97 | - width: 130rpx; | 115 | + width: 140rpx; |
| 98 | - height: 130rpx; | 116 | + height: 140rpx; |
| 99 | position: absolute; | 117 | position: absolute; |
| 100 | top: -100rpx; | 118 | top: -100rpx; |
| 101 | left: 50%; | 119 | left: 50%; |
| ... | @@ -103,21 +121,18 @@ const on_select = (key) => { | ... | @@ -103,21 +121,18 @@ const on_select = (key) => { |
| 103 | } | 121 | } |
| 104 | } | 122 | } |
| 105 | 123 | ||
| 106 | - .nav-icon-placeholder { | 124 | + .nav-logo.is-home, |
| 107 | - width: 48rpx; | 125 | + .nav-logo.is-me { |
| 108 | - height: 48rpx; | 126 | + .nav-icon { |
| 127 | + width: 56rpx; | ||
| 128 | + height: 56rpx; | ||
| 129 | + } | ||
| 109 | } | 130 | } |
| 110 | 131 | ||
| 111 | .nav-text { | 132 | .nav-text { |
| 112 | - font-size: 24rpx; | 133 | + font-size: 26rpx; |
| 113 | margin-top: 12rpx; | 134 | margin-top: 12rpx; |
| 114 | line-height: 1; | 135 | line-height: 1; |
| 115 | } | 136 | } |
| 116 | - | ||
| 117 | - .nav-logo.is-center-raised { | ||
| 118 | - .nav-text { | ||
| 119 | - margin-top: -10rpx; | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | } | 137 | } |
| 123 | </style> | 138 | </style> | ... | ... |
| ... | @@ -264,7 +264,8 @@ useShareAppMessage(() => { | ... | @@ -264,7 +264,8 @@ useShareAppMessage(() => { |
| 264 | backdrop-filter: blur(6px); | 264 | backdrop-filter: blur(6px); |
| 265 | } | 265 | } |
| 266 | .index-content { | 266 | .index-content { |
| 267 | - height: calc(100vh - 134rpx); | 267 | + height: calc(100vh - 134rpx - constant(safe-area-inset-bottom)); |
| 268 | + height: calc(100vh - 134rpx - env(safe-area-inset-bottom)); | ||
| 268 | .index-control { | 269 | .index-control { |
| 269 | position: relative; | 270 | position: relative; |
| 270 | display: flex; | 271 | display: flex; | ... | ... |
-
Please register or login to post a comment