框架:uni-app
场景:即取消默认的原生导航栏
解决方法可参考:
uni-app自定义导航栏使用注意
// pages.json
{
...
"globalStyle": {
...
"navigationStyle": "custom",
}
}
<template>
<view>
// 占位
<view class="status_bar" :style="headStyle"></view>
// 自定义导航栏
<u-navbar title="工作台">
<view class="u-nav-slot" slot="left"></view>
</u-navbar>
</view>
</template>
export default {
computed: {
...
// 头部占位
headStyle() {
// 获取当前状态栏的高度
const {
statusBarHeight = 20
} = uni.getSystemInfoSync();
return `width: 100%; height: ${statusBarHeight + 44}px`;
}
}
}