<template>
<view class="container">
<view :style="{height: navigationBarAndStatusBarHeight+'px'}" class="A">
<view :style="{paddingTop:(statusBarHeight+10)+'px',width: '100%',backgroundColor:'#ff0a43'}">
<view class="">数据构建区域</view>
</view>
</view>
<!-- #ifdef MP-WEIXIN -->
<view class="">
微信自定义导航栏,位于胶囊下方区域,内容展示区
</view>
<!-- #endif -->
</view>
</template>
<script>
export default {
data() {
return {
statusBarHeight: 0,
navigationBarHeight: 0,
menuButtonHeight: 0,
navigationBarAndStatusBarHeight: 0,
}
},
methods: {
back() {
wx.navigateBack({
delta: 1
})
},
getNavigationBarHeight() {
const {
statusBarHeight,
platform
} = wx.getSystemInfoSync()
const {
top,
height
} = wx.getMenuButtonBoundingClientRect()
this.statusBarHeight = statusBarHeight
this.menuButtonHeight = height ? height : 32
if (top && top !== 0 && height && height !== 0) {
this.navigationBarHeight = (top - statusBarHeight) * 2 + height
} else {
this.navigationBarHeight = platform === 'android' ? 48 : 40
}
this.navigationBarAndStatusBarHeight = this.statusBarHeight + this.navigationBarHeight
console.log("this.", this.navigationBarAndStatusBarHeight, this.statusBarHeight, this.navigationBarHeight,
this.menuButtonHeight);
},
},
onShow() {
this.getNavigationBarHeight();
},
}
</script>
<style scoped>
.A {
width: 100%;
display: flex;
flex-direction: row;
}
</style>