"window": {
"navigationStyle": "custom"//自定义需要配置的内容
},
app.js
App({
onLaunch: function () {
// 获取顶部栏信息
wx.getSystemInfo({
success: res => {
//导航高度
this.globalData.navHeight = res.statusBarHeight + 46;
}, fail(err) {
console.log(err);
}
})
},
globalData: {
userInfo: null,
navHeight: 0
}
})
index.js引用
const App = getApp();//设立顶部栏高度
Page({
data:{},
onLoad: function (options) {
//自定义头部方法
this.setData({
navH: App.globalData.navHeight
});
}
})
带搜索栏
index.wxml
<!-- 自定义头部 -->
<view class='nav bg-white' style='height:{{navH}}px'>
<view class='nav-title'>
<view class="INinputheader">
<icon class="INsearchicon" type="search" size="12"/>
<input class="weui-input" placeholder="搜索学习内容"/>
</view>
</view>
</view>
index.wxss
/* 自定义顶部栏高度 */
.nav{
width: 100%;
overflow: hidden;
position: relative;
top: 0;
left: 0;
z-index: 10;
}
.nav-title{
width: 100%;
height: 45px;
line-height: 45px;
text-align: center;
position: absolute;
bottom: 0;
left: 0;
z-index: 10;
font-family:PingFang-SC-Medium;
font-size:36rpx;
letter-spacing:2px;
}
.nav .back{
width: 22px;
height: 22px;
position: absolute;
bottom: 0;
left: 0;
padding: 10px 15px;
}
.bg-white{
background-color:#FFCE58;
}
.INinputheader{
width:60%;
height:30px;
background:rgba(255,255,255,1);
border-radius:30px;
font-size: 14px;
margin-top:7px;
position: relative;
float: left;
margin-left:12px;
}
.INsearchicon{
position: absolute;
left:12px;
}
.weui-input{
height: 30px;
line-height: 30px;
text-align: left;
padding-left: 30px;
letter-spacing:0px;
}
.INtab{
text-align: left;
margin-left: 12px;
color: #fff;
}
带返回箭头
html
<!-- 自定义头部栏 -->
<view class="setNav" style='height:{{navH}}px'>
<view class="tool">
<view class="goBack" bindtap="goBack"></view>
<view class="sets">订单详情</view>
</view>
</view>
css
/* 自定义头部栏 */
.setNav {
width: 100%;
overflow: hidden;
position: relative;
top: 0;
left: 0;
z-index: 10;
background-color: #fff;
}
.setNav .tool {
width: 94%;
display: flex;
position: absolute;
bottom: 0;
left: 3%;
}
.setNav .goBack {
width: 16rpx;
height: 16rpx;
border-top: 1px solid;
border-right: 1px solid;
transform: rotate(-135deg);
align-self: center;
}
.setNav .sets {
width: 100%;
height: 90rpx;
line-height: 90rpx;
text-align: center;
}
js
// 返回上个页面
goBack() {
wx.navigateBack({
delta: 1,
})
},
文章版权声明
1 原创文章作者:2110,如若转载,请注明出处: https://www.52hwl.com/35756.html
2 温馨提示:软件侵权请联系469472785#qq.com(三天内删除相关链接)资源失效请留言反馈
3 下载提示:如遇蓝奏云无法访问,请修改lanzous(把s修改成x)
4 免责声明:本站为个人博客,所有软件信息均来自网络 修改版软件,加群广告提示为修改者自留,非本站信息,注意鉴别