uni-app:自定义顶部导航栏(hbuilderx 3.7.3)
一,代码:
说明:我们使整个顶部导航栏透明,只保留一个退回上一页的按钮
模板
<!-- 自定义导航栏 --> <view class="navBarBox" style="position: fixed;top:0;z-index: 1000;"> <!-- 状态栏占位 --> <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view> <!-- 导航栏内容 --> <view class="navBar" style="height:93rpx;"> <view style="width:93rpx;height:93rpx;margin-left: 20rpx;display: flex; flex-direction: row;justify-content: center;align-items: center;" @click="goBack"> <!-- 返回上一页--> <uni-icons type="back" size="30"></uni-icons> </view> </view> </view>
js:
export default { data() { return {// 状态栏高度 statusBarHeight: 0, // 导航栏高度 navBarHeight: 82+11, } }, onLoad(option) { //获取手机状态栏高度 this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; },
说明:刘宏缔的架构森林是一个专注架构的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/06/05/uniapp-zi-ding-yi-ding-bu-dao-hang-lan-hbuilderx-3-7-3/
对应的源码可以访问这里获取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,查看效果
web:
微信小程序:
三,查看hbuilderx的版本:

分类:
uni-app
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
2021-02-24 spring boot:从yaml配置文件中读取数据的四种方式(spring boot 2.4.3)