H5根路径找不到
H5根路径匹配不到组件 [问题描述:编译H5版本,首页内容无法展示,其他页面都能正常展示。]
复现步骤 [复现问题的步骤]
- 编译到浏览器默认打开的首页是空白
系统信息:
- 发行平台: [h5]
- 操作系统 [window 10]
- HBuilderX版本 [3.3.5]
- 项目创建方法 [HBuilderX]
- uni-simple-router版本 [ 2.0.7]
补充信息 [可选] 为了pages.json 热重载。使用了 uni-pages-hot-modules。github联系:https://github.com/devilwjp/uni-pages-hot-modules-demo/tree/master/src 。 参考官方代码使用。所有页面路径,单独维护在page_modules中。 编译到app端没有问题,编译到H5页面。出现首页无法加载。
// main.js 文件中 // #ifdef H5 console.log('路由信息', router); RouterMount(app, router, '#app') // #endif
打印信息里看到 router.$route.options.routes[0] 定义了path是 ‘/’ 但是component对象中。会有额外name属性。并且值有点怪异,下面贴图中可以看到多拼接了 -1 ,我认为有可能这里导致的问题。

请上传一个demo让我排除下
文件发给您了,运行在H5端首页没有,路径更改为:pages/msg/index就能显示出来。就是首页不行。您看看
------------------ 原始邮件 ------------------ 发件人: "SilurianYang/uni-simple-router" @.>; 发送时间: 2021年12月31日(星期五) 下午5:49 @.>; @.@.>; 主题: Re: [SilurianYang/uni-simple-router] H5根路径找不到 (Issue #354)
请上传一个demo让我排除下
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>