1***@qq.com
1***@qq.com
  • 发布:2024-03-15 09:58
  • 更新:2024-03-15 10:52
  • 阅读:261

uni.reLaunch 跳转url如果使用变量会自动拼接当前目录地址?

分类:uni-app
//1.报错情况  
//分包地址  
let str = "/epermarketSub/NewType?ProductCataID=604"  

uni.reLaunch({  
    url:str,  
    fail(err) {  
        console.log(err);  
                //当前页面在/pages/Authorization/目录下此时报错信息如下  
                //errMsg: "reLaunch:fail page `/pages/Authorization/ /epermarketSub/NewType?ProductCataID=604` is not found"  
    }  
});  
//2.正常可跳转情况  
uni.reLaunch({  
    url:"/epermarketSub/NewType?ProductCataID=604" //或使用“../../epermarketSub/NewType?ProductCataID=604”也可正常跳转,  
    fail(err) {  
        console.log(err);  
    }  
});  
//如何解决使用变量也可跳转?
2024-03-15 09:58 负责人:无 分享
已邀请:
套马杆的套子

套马杆的套子 - 没有解决不了的问题,只有解决不完的问题

/pages/Authorization/epermarketSub/NewType?ProductCataID=604
这样试试能行么

  • 1***@qq.com (作者)

    不行的 分包完整地址是“/epermarketSub/NewType?ProductCataID=604”,他相当于是在主包目录下找分包的位置 所以肯定是报错的 但是我url填写的是分包的路径 很奇怪

    2024-03-15 10:54

  • 套马杆的套子

    回复 1***@qq.com: 看下你的subPackages

    2024-03-15 11:24

要回复问题请先登录注册