需求
实现小程序隐藏头部导航栏,且导航栏穿透无高度,并且要定义返回事件
直接上图
index.wxml
<!-- 组件 custom-component.wxml -->
<custom-component>
<view class='flex commonHead' style='color:{{myProperty.color?myProperty.color:"#000"}};height:{{commonHeadHeight.titleHeight}}px;'>
<view class='commonHead-wrap flex'>
<!-- 0:无返回;1:返回上一级;2:home -->
<view class='commonHead_left'>
<view class='commonHead_left_back' bindtap='commonHead_left_back'></view>
<view wx:if="{{myProperty.flag==2}}" class='commonHead_left_home' bindtap='commonHead_left_home'></view>
</view>
<view class='commonHead_right flex'>
<view class='commonHead_right_text line1'>{{myProperty.name?myProperty.name:""}}</view>
</view>
</view>
</view>
</custom-component>
index.js
Component({
properties: {
myProperty: {
type: Object,
value: {
"bg_color": "none",
"color": "#000",
"flag": 1,
"name": "我是标题"
}
},
commonHeadHeight: {
type: Object,
value: {}
}
},
data: {
}, // 私有数据,可用于模版渲染
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
attached: function() {},
moved: function() {},
detached: function() {},
},
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
attached: function() {}, // 此处attached的声明会被lifetimes字段中的声明覆盖
ready: function() {
var that = this;
wx.getSystemInfo({
success(res) {
that.setData({
"commonHeadHeight.statusBarHeight": (34 * 2),
"commonHeadHeight.titleHeight": res.statusBarHeight + 46
});
wx.setStorageSync('titleHeight',res.statusBarHeight + 46)
}
})
},
pageLifetimes: {
// 组件所在页面的生命周期函数
show: function() {
},
},
methods: {
//处理自定义左上角返回按钮事件(也可emit传递给父组件使用)
commonHead_left_back: function() {
console.log("back")
wx.reLaunch({
url: '/pages/index/index'
})
},
//处理自定义返回首页事件(也可emit传递给父组件使用)
commonHead_left_home: function() {
console.log("home")
wx.reLaunch({
url: '/pages/index/index'
})
}
}
})
index.wxss
/*弹性布局*/
.flex {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
display: box;
flex-wrap: wrap;
}
.noWarp {
flex-wrap: nowrap;
}
/*元素居中*/
.alignC {
align-items: center;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
}
/*水平排列*/
.flexH {
-webkit-box-orient: horizontal;
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
}
/*垂直排列*/
.flexV {
-webkit-box-orient: vertical;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
-o-flex-direction: column;
flex-direction: column;
}
/*两端对齐*/
.flexSa {
-webkit-box-pack: justify;
justify-content: space-around;
-webkit-justify-content: space-around;
-moz-justify-content: space-around;
-ms-justify-content: space-around;
-o-justify-content: space-around;
}
/*居中对齐*/
.flexC {
-webkit-box-pack: center;
justify-content: center;
-webkit-justify-content: center;
-moz-justify-content: center;
-ms-justify-content: center;
-o-justify-content: center;
}
.flexSb {
justify-content: space-between;
-webkit-justify-content: space-between;
-moz-justify-content: space-between;
-ms-justify-content: space-between;
-o-justify-content: space-between;
}
.flexS {
-webkit-box-pack: start;
justify-content: flex-start;
-webkit-justify-content: flex-start;
-moz-justify-content: flex-start;
-ms-justify-content: flex-start;
-o-justify-content: flex-start;
}
.flexE {
-webkit-box-pack: end;
justify-content: flex-end;
-webkit-justify-content: flex-end;
-moz-justify-content: flex-end;
-ms-justify-content: flex-end;
-o-justify-content: flex-end;
}
.line1 {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.commonHead {
width: 100%;
height: 128rpx;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
overflow: hidden;
position: relative;
z-index: 10;
}
.commonHead-wrap {
width: 100%;
position: absolute;
overflow: hidden;
left: 0;
bottom: 0;
height: 45px;
line-height: 45px;
}
.commonHead_left {
width: 100rpx;
height: 100%;
position: absolute;
left: 0;
top: 0
}
.commonHead_left_back {
width: 100%;
height: 100%;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEU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BRTnaimNxLI7dfnvWc5AOAYEelvtnbR0Kh8KhJUuyHoN0CAjkQF43kngunovnLl3Keg7SISCQI7nbSB4Pj4fH//73rMcgHQICOZSXjWTe6LzReaNHjmQ9B+kQEMixnt1Ing3PhmdrteYLCf/616zHIR3zsh4AmLupqampqamTJ5dOLp1cOjkx0QzJ5s3NtxqZP7/rA70V3gpv/ehHzbn+9resHx/S4YWEUEBZvWljHI2jcfRXvxpfNr5sfNlPfpL140C6HGFBAbWOtmIjNmLjwQfjsXgsHvvXv1L7gzHEEF99NdmSbEm27NyZ9f2nO2wgUAL9F/sv9l9cvjx5M3kzeXPfvmQ4GU6GBwfb/oWDYTAMXr4cToQT4cTPfta8qP/cc80vxpj1/aU7bCBQAhPXT1w/cf2f/zy+YXzD+IbVq5u3PvhgPBwPx8O//W1YFVaFVRcuXPlzcSSOxJHp6fh2fDu+PTHRvHXXrsrZytnK2W9/uxmOX/ziP98tHABltWL/iv0r9i9a1HxTx69/fWhoaGhoaJ4n2wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN3xb0bhMe/23em4AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTMwVDE0OjA1OjA5KzA4OjAwyZa0zQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0zMFQxNDowNTowOSswODowMLjLDHEAAABHdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzFvYmhsMGQwMjk1L2JhY2suc3ZngFiTQgAAAABJRU5ErkJggg==);
background-size: 40rpx 40rpx;
background-repeat: no-repeat;
background-position: center;
}
.commonHead_left_home {
width: 100%;
height: 100%;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADIEAYAAAD9yHLdAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgA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MQxqLmoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMzBUMTQ6MDU6MDkrMDg6MDDJlrTNAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTMwVDE0OjA1OjA5KzA4OjAwuMsMcQAAAEd0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vaG9tZS9hZG1pbi9pY29uLWZvbnQvdG1wL2ljb25fMW9iaGwwZDAyOTUvaG9tZS5zdmfEnSvGAAAAAElFTkSuQmCC);
background-size: 40rpx 40rpx;
background-repeat: no-repeat;
background-position: center;
}
.commonHead_right {
/* width: 450rpx; */
width: 100%;
height: 100%;
line-height: 88rpx;
text-align: center;
font-size: 30rpx;
overflow: hidden;
justify-content:flex-end;
}
.commonHead_right_text {
/* width: 450rpx; */
width: 280rpx;
margin: 0 auto;
}
index.json
{
"component": true,
"usingComponents": {}
}
页面引用
json配置
在 app.json 里面把 “navigationStyle” 设置为 “custom”文章来源:https://www.toymoban.com/news/detail-598141.html
这样子之后页面就只会保留右上角胶囊按钮。文章来源地址https://www.toymoban.com/news/detail-598141.html
{
"navigationStyle":"custom",
"usingComponents": {
"my-component": "/components/custom-component/my-component"
},
"component": true,
"navigationBarTitleText": ""
}
wxml
<view class="container" >
<my-component my-property='' />
</view>
到了这里,关于小程序导航穿透且自定义导航栏的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!