After the h5 project packaged by uniapp is refreshed, the routing is lost and the project returns to the problem of jumping out.

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>
      

Guess you like

Origin blog.csdn.net/m0_69257679/article/details/132707216