uniapp自定义头部导航怎么实现?

简介: uniapp自定义头部导航怎么实现?

一、在pages.json文件里边写上自定义属性

"navigationStyle": "custom"

二、在对应的index页面写上以下:

<view :style="{ height: headheight + 'px', backgroundColor: '#24B7FF', zIndex: 99, position: 'fixed', top: '0px', width: '100%' }">
</view>
<view class="head" :style="{ top: headheight + 'px', backgroundColor: '#24B7FF' }">
  <view>新乡市</view>
</view>
<view style="height: 100rpx;"></view>

三、在script标签的return里边写上

headheight: '',

四、在onLoad()周期里面写上

const systemInfo = uni.getSystemInfoSync();
const windowHeight = systemInfo.statusBarHeight;
this.headheight = windowHeight;

五、style

.head {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    height: 100rpx;
    width: 100%;
    z-index: 99;
  }

效果:

相关文章
|
4月前
uniapp Vue3 面包屑导航 带动态样式
uniapp Vue3 面包屑导航 带动态样式
57 1
|
4月前
|
Web App开发 小程序 Android开发
Uniapp 底部导航栏 自定义 tabBar 全端 全页面引用跳转 组件
Uniapp 底部导航栏 自定义 tabBar 全端 全页面引用跳转 组件
79 0
|
5月前
|
JSON 数据格式
uniapp自定义头部导航样式
uniapp自定义头部导航样式
73 0
|
1月前
|
小程序 程序员
【uniapp微信小程序】自定义导航栏:非首页展示的实现方式(极为快捷方式)
【uniapp微信小程序】自定义导航栏:非首页展示的实现方式(极为快捷方式)
21 0
|
3月前
|
JavaScript API
uniapp自定义导航栏方法
uniapp自定义导航栏方法
44 0
|
4月前
uniapp自定义tabbar
uniapp自定义tabbar
34 0
|
4月前
|
JavaScript
uniapp用picker实现自定义三级联动(children)
uniapp用picker实现自定义三级联动(children)
56 0
|
4月前
|
JavaScript
uniapp自定义的日历(纯手写)
uniapp自定义的日历(纯手写)
61 0
|
2天前
|
小程序
uniapp-微信小程序-上拉和下拉触底刷新
uniapp-微信小程序-上拉和下拉触底刷新
6 0
|
2天前
|
Web App开发 数据采集 移动开发
开发uniapp过程中对app、微信小程序与h5的webview调试
开发uniapp过程中对app、微信小程序与h5的webview调试