2024-11-25 13:57:24 +08:00

75 lines
1.8 KiB
Vue

<template>
<view :class="themeType?'whiteHeaderBox':''">
<!-- 手机状态层 -->
<view :style="{ height: mobileTopHeight + 'px' }" class="statusBar"></view>
<view class="headerBox">
<u-icon v-if="iconType" class="backImg" @click="$emit('select')" v-show="showBack" name="list" size="40"></u-icon>
<uni-icons v-else @click="goBackFn" v-show="showBack" class="backImg" type="left" size="24"></uni-icons>
<slot></slot>
<view class="rightIcon">
<slot name="right"></slot>
</view>
</view>
</view>
</template>
<script>
export default {
props:['showBack','themeType','iconType'],
data() {
return {
mobileTopHeight: 0
};
},
mounted() {
// if(uni.getMenuButtonBoundingClientRect()){
// this.mobileTopHeight = uni.getMenuButtonBoundingClientRect().top
// }else{
// this.mobileTopHeight = 0
// }
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 22;
uni.setStorageSync('systemInfo',res)
console.log(1111, res)
}
})
console.log('this.mobileTopHeight',this.mobileTopHeight)
},
methods:{
goBackFn(){
uni.navigateBack({
success: function() {
// console.log('getCurrentPages()',getCurrentPages())
// let page = getCurrentPages()[0]; //跳转页面成功之后
// if(page.route=='pages/projectManage/projectManage'){
// }
// if (!page) return;
// page.onLoad(); //如果页面存在,则重新刷新页面
}
})
}
}
}
</script>
<style lang="scss" scoped>
.statusBar{
background-color: #2a2b5b;
}
.whiteHeaderBox{
.statusBar{
background-color: #2b8df3;
}
.rightIcon{
position: absolute;
right: 20rpx;
top: 50%;
transform: translateY(-50%);
z-index: 10;
}
}
</style>