1. Uniapp has many bugs and is not yet perfected.
First, instead of using the built-in header nav in pages.json, use "navigationStyle": "custom" , // hide the system navigation bar
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationStyle": "custom", // 隐藏系统导航栏
"enablePullDownRefresh": false
}
2. What I use here is the u-navbar component from the uView official website.
<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>