You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
867 B

<template>
<!--顶部-->
<view class="TopNavHeight Width100" :style="'height:' + topHeight + 'px;'">
</view>
</template>
<script>
export default {
name: "top-nav-height",
props: {
},
data() {
return {
topHeight:0, // 导航栏高度
}
},
mounted(){
// 状态栏高度
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight
let navigationBarHeight = 0
let custom = 0
// #ifdef MP-WEIXIN
custom = wx.getMenuButtonBoundingClientRect()
navigationBarHeight = custom.height + (custom.top - statusBarHeight) * 2
// #endif
this.topHeight = navigationBarHeight + statusBarHeight
},
methods: {
// 获取url
getCurPage() {
let pages = getCurrentPages();
let curPage = pages[pages.length - 1];
return curPage
},
},
}
</script>
<style scoped lang="scss">
</style>