2025-07-22 11:21:01 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="custom-navbar">
|
|
|
|
|
|
<view class="navbar-main" :style="{paddingTop:navBarPaddingTop+'px'}">
|
|
|
|
|
|
<!-- 左侧内容 -->
|
|
|
|
|
|
<view class="navbar-left" @click="handleBack" v-if="leftFlag">
|
|
|
|
|
|
<uni-icons type="left" size="24" color="#fff"></uni-icons>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 中间标题 -->
|
|
|
|
|
|
<view class="navbar-title">{{ title }}</view>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 右侧内容 -->
|
|
|
|
|
|
<view class="navbar-right" v-if="rightFlag">
|
|
|
|
|
|
<slot name="right"></slot>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
|
|
|
import { getNavBarPaddingTop,getNavBarHeight,getStatusBarHeight} from '@/utils/system.js'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
title: String,
|
|
|
|
|
|
leftFlag:true,//默认左侧显示 false-不显示
|
|
|
|
|
|
rightFlag:false,//默认右侧不显示
|
2025-08-18 15:50:40 +08:00
|
|
|
|
searchType:{default:0}//搜索返回为1,其他暂时不处理
|
2025-07-22 11:21:01 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['back'])
|
|
|
|
|
|
|
|
|
|
|
|
let navBarPaddingTop = ref(0)
|
|
|
|
|
|
let statusBarHeight = ref(0)
|
|
|
|
|
|
let navbarHeight = ref(0)
|
|
|
|
|
|
let navHeight = ref(0)
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
2025-08-11 17:30:44 +08:00
|
|
|
|
navBarPaddingTop.value = getNavBarPaddingTop();
|
2025-07-22 11:21:01 +08:00
|
|
|
|
statusBarHeight.value = getStatusBarHeight();
|
|
|
|
|
|
navbarHeight.value = getNavBarHeight();
|
|
|
|
|
|
navHeight.value = navbarHeight.value - statusBarHeight.value
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const handleBack = () => {
|
|
|
|
|
|
emit('back')
|
2025-08-18 15:50:40 +08:00
|
|
|
|
if(!props.searchType)
|
|
|
|
|
|
uni.navigateBack()
|
2025-07-22 11:21:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.custom-navbar {
|
|
|
|
|
|
width: 750rpx;
|
|
|
|
|
|
position: fixed;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 50%;
|
|
|
|
|
|
margin-left:-375rpx;
|
|
|
|
|
|
z-index: 999;
|
|
|
|
|
|
/* #ifdef APP-PLUS */
|
2025-08-19 13:27:26 +08:00
|
|
|
|
/* background: url('@/static/images/bg-Blue-header.png') no-repeat;
|
2025-07-22 11:21:01 +08:00
|
|
|
|
background-size:750rpx 160rpx;
|
2025-08-19 13:27:26 +08:00
|
|
|
|
height:160rpx; */
|
2025-07-22 11:21:01 +08:00
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
|
|
|
|
/* #ifndef APP-PLUS */
|
2025-08-19 13:27:26 +08:00
|
|
|
|
/* background: url('@/static/images/bg-Blue-header2.png') no-repeat;
|
2025-07-22 11:21:01 +08:00
|
|
|
|
background-size:750rpx 116rpx;
|
2025-08-19 13:27:26 +08:00
|
|
|
|
height:116rpx; */
|
2025-07-22 11:21:01 +08:00
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.navbar-content {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.navbar-main {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
padding: 0 30rpx;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
color:#fff;
|
|
|
|
|
|
/* #ifdef APP-PLUS */
|
|
|
|
|
|
height:160rpx;
|
|
|
|
|
|
/* #endif */
|
|
|
|
|
|
/* #ifndef APP-PLUS */
|
|
|
|
|
|
height:116rpx;
|
|
|
|
|
|
/* #endif */
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.navbar-left{
|
|
|
|
|
|
width: 70rpx;
|
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.navbar-title {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
color:#fff;
|
|
|
|
|
|
margin-top:-3rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.navbar-right{
|
|
|
|
|
|
margin-left: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|