uniapp 打包后放入cordova www 文件包后一直白屏,卡了很久,在老大帮助下终于找到问题,以下是具体操作:

1. 在 manifest.json 修改下面内容:

    1)在mainfest.json中设置h5节点的publicPath为:’./'打包后即为相对路径   "publicPath":"./",

    2) mainfest.json中设置h5节点 增加以下内容:

       "router" : {
            "mode" : "hash",
            "basePath":""
        }

    修改后的 mainfest.json中 h5节点 的代码是这样的:

    "h5" : {
        "devServer" : {
            "port" : 8080,
            "disableHostCheck" : true
        },
        "title" : "项目标题",
        "domain" : "",
        "template" : "index.html",
        "publicPath":"./",
        "router" : {
            "mode" : "hash",
            "basePath":""
        }
    }

3. 修改打包后的配置文件

修改index.xxxxx.js文件的 uniConfig.router={mode:"hash",base:"/"}改成uniConfig.router={mode:"hash",base:"./"}

cordova +uniapp 打包android

 

然后重新cordova run android, 就可以啦~~

 

相关文章:

  • 2021-05-31
  • 2021-09-18
  • 2021-12-22
  • 2021-10-27
  • 2021-08-29
  • 2021-05-25
  • 2021-09-29
  • 2021-11-23
猜你喜欢
  • 2022-01-07
  • 2021-12-03
  • 2022-12-23
  • 2021-04-15
  • 2021-04-08
  • 2021-06-21
  • 2021-10-17
相关资源
相似解决方案