您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

uniapp如何实现自定义设置导航栏

2024/3/20 2:36:06发布18次查看
uniapp实现自定义设置导航栏的方法:使用一个view,代码为【43f2367825c6e73bc5325670c50d2dd7,e88e63bd5420b02859605c633e78dbddde5f4c1163741e920c998275338d29b2】。
本教程操作环境:windows7系统、uni-app2.5.1版本,该方法适用于所有品牌电脑。
推荐(免费):uni-app开发教程
uniapp实现自定义设置导航栏的方法:
在单页面关闭默认的导航栏
"navigationstyle": "custom"
官方获取的参数是
参数详解
实现原理
用一个view,padding-top=top;height=height;padding-bottom=给一个自己喜欢的数值+rpx
实现的代码
<template> <view> <view :style="'height:' + demo.height + 'px;' + 'padding-top:' + demo.top + 'px;padding-bottom:10rpx'"> <view :style="'top:' + demo.top + 'px'"> <view class="iconfont icon-xiaoxi"></view> </view> 测试辣 </view> </view></template><script> export default { data () { return { demo: { top: 0, height: 0 } } }, created () { const demo = uni.getmenubuttonboundingclientrect() this.demo.top = demo.top this.demo.height = demo.height } }</script><style> .demo{ position: relative; display: flex; align-items: center; justify-content: center; background: #fff; font-size: 26rpx; .left{ float: left; position: absolute; width: max-content; height: max-content; top: 0; bottom: 0; left: 20rpx; margin: auto; .iconfont{ color: #3c3c3c; } } }</style>
效果
相关免费学习推荐:php编程(视频)
以上就是uniapp如何实现自定义设置导航栏的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product