一、uniapp有很多bug未完善
首先在pages.json中不用自带的头部nav,使用 "navigationStyle": "custom", // 隐藏系统导航栏
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationStyle": "custom", // 隐藏系统导航栏
"enablePullDownRefresh": false
}
二、我这里使用的是uView官网中,u-navbar组件
<template>
<view>
<u-navbar :custom-back="returnBack" :title="name" :border-bottom="false" :back-icon-
size="26" :title-width="450" title-color="#fff"></u-navbar>
</view>
</template>
<script>
methods: {
returnBack() {
let returnNavBack = getCurrentPages()
if (returnNavBack && returnNavBack.length > 1) {
uni.navigateBack()
} else {
history.back();
}
},
}
</script>