uniapp打包的h5项目刷新之后路由丢失,返回跳出项目问题

一、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>
      

猜你喜欢

转载自blog.csdn.net/m0_69257679/article/details/132707216
今日推荐