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;
  }

效果:

相关文章
|
3月前
uniapp Vue3 面包屑导航 带动态样式
uniapp Vue3 面包屑导航 带动态样式
54 1
|
3月前
|
Web App开发 小程序 Android开发
Uniapp 底部导航栏 自定义 tabBar 全端 全页面引用跳转 组件
Uniapp 底部导航栏 自定义 tabBar 全端 全页面引用跳转 组件
75 0
|
4月前
|
JSON 数据格式
uniapp自定义头部导航样式
uniapp自定义头部导航样式
56 0
|
17天前
|
小程序 程序员
【uniapp微信小程序】自定义导航栏:非首页展示的实现方式(极为快捷方式)
【uniapp微信小程序】自定义导航栏:非首页展示的实现方式(极为快捷方式)
13 0
|
2月前
|
JavaScript API
uniapp自定义导航栏方法
uniapp自定义导航栏方法
42 0
|
3月前
uniapp自定义tabbar
uniapp自定义tabbar
32 0
|
3月前
|
JavaScript
uniapp用picker实现自定义三级联动(children)
uniapp用picker实现自定义三级联动(children)
52 0
|
3月前
|
JavaScript
uniapp自定义的日历(纯手写)
uniapp自定义的日历(纯手写)
53 0
|
8天前
|
小程序 JavaScript Java
基于SpringBoot+Vue+uniapp微信小程序的优购电商小程序的详细设计和实现
基于SpringBoot+Vue+uniapp微信小程序的优购电商小程序的详细设计和实现
31 0
|
8天前
|
小程序 JavaScript Java
基于SpringBoot+Vue+uniapp微信小程序的微信课堂助手小程序的详细设计和实现
基于SpringBoot+Vue+uniapp微信小程序的微信课堂助手小程序的详细设计和实现
40 3

热门文章

最新文章