Skip to content

Commit 4f8c388

Browse files
committed
新增:允许自定义导航栏塌陷,以便于沉浸式导航栏设计
1 parent 9d07eb4 commit 4f8c388

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

uview-ui/components/u-navbar/u-navbar.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</view>
2929
</view>
3030
<!-- 解决fixed定位后导航栏塌陷的问题 -->
31-
<view class="u-navbar-placeholder" v-if="isFixed" :style="{ width: '100%', height: Number(navbarHeight) + statusBarHeight + 'px' }"></view>
31+
<view class="u-navbar-placeholder" v-if="isFixed && !immersive" :style="{ width: '100%', height: Number(navbarHeight) + statusBarHeight + 'px' }"></view>
3232
</view>
3333
</template>
3434

@@ -59,6 +59,7 @@
5959
* @property {Boolean} is-back 是否显示导航栏左边返回图标和辅助文字(默认true)
6060
* @property {Object} background 导航栏背景设置,见官网说明(默认{ background: '#ffffff' })
6161
* @property {Boolean} is-fixed 导航栏是否固定在顶部(默认true)
62+
* @property {Boolean} immersive 沉浸式,允许fixed定位后导航栏塌陷,仅fixed定位下生效(默认false)
6263
* @property {Boolean} border-bottom 导航栏底部是否显示下边框,如定义了较深的背景颜色,可取消此值(默认true)
6364
* @example <u-navbar back-text="返回" title="剑未配妥,出门已是江湖"></u-navbar>
6465
*/
@@ -137,6 +138,11 @@
137138
type: Boolean,
138139
default: true
139140
},
141+
// 是否沉浸式,允许fixed定位后导航栏塌陷,仅fixed定位下生效
142+
immersive: {
143+
type: Boolean,
144+
default: false
145+
},
140146
// 是否显示导航栏的下边框
141147
borderBottom: {
142148
type: Boolean,

0 commit comments

Comments
 (0)