<view class="header" :style="'height:'+height+'px'">
<icon class="iconfont icon-xiangyou"></icon>
<text>返回</text>
</view>```
<script>
export default {
data() {
return {
height: 30
}
},
onLoad() {
},
created() {
var _this = this;
uni.getSystemInfo({
success:function(e){
// #ifdef MP-WEIXIN
let custom = wx.getMenuButtonBoundingClientRect()
_this.height = custom.bottom + custom.top - e.statusBarHeight
// #endif
}
})
},
}
</script>
uniapp实现自定义导航时动态获取导航栏的高度
最新推荐文章于 2025-07-19 22:09:48 发布
本文介绍了一种在小程序中实现页面头部自适应高度的方法,通过获取系统信息及菜单按钮的位置尺寸来动态调整顶部区域的高度。
6157

被折叠的 条评论
为什么被折叠?



