h5链接转发参数丢失

小程序 文章 2021-12-21 11:40 864 0 全屏看文

AI助手支持GPT4.0

h5链接转发参数丢失H5 link forwarding parameters are lost

h5链接转发参数丢失

直接使用微信内置的刷新页面也是正确的,使用浏览器打开也是正确的但是使用转发和复制链接就失败了,访问根目录

就是一个普通的链接,没有使用自定义分享


复现方式一(转发参数丢失)

1、访问http://aboc.agri.cn:8080/

2、进入页面打开一个资讯http://aboc.agri.cn:8080/#/infoDetail?id=922782776212586496

3、利用微信内置的转发给一个联系人,显示的名字和url都是正确的

4、但是。。。点击这条消息,直接进入了根目录http://aboc.agri.cn:8080/

复现方式二(复制链接参数丢失)

1、访问http://aboc.agri.cn:8080/

2、进入页面打开一个资讯http://aboc.agri.cn:8080/#/infoDetail?id=922782776212586496

3、使用内置的复制链接,复制出来的链接就是根目录http://aboc.agri.cn:8080/没有了后面的参数

It is also correct to directly use the built-in refresh page of wechat and open it with the browser, but it fails to use forwarding and copying links. Accessing the root directory is an ordinary link and does not use the custom sharing reproduction method. 1 (forwarding parameters are lost) 1. Access http://aboc.agri.cn:8080/ 2. Enter the page to open a message http://aboc.agri.cn:8080/#/infoDetail?id=922782776212586496 3. Use the built-in wechat to forward to a contact, and the displayed name and URL are correct. 4. But... Click this message to directly enter the root directory http://aboc.agri.cn:8080/ Reproduction mode 2 (copy link parameters are lost) 1. Access http://aboc.agri.cn:8080/ 2. Enter the page to open a message http://aboc.agri.cn:8080/#/infoDetail?id=922782776212586496 3. Use the built-in copy link. The copied link is the root directory http://aboc.agri.cn:8080/ There are no subsequent parameters

回答:

微喵网络:

改用history模式吧

圣殿骑士:

是react-router 项目吗?

这类带# 号的路由,很容易翻车啊

建议改下,变成 url传参 或者 去掉#

比如 https://aaa/#/bbb?c=ddd#eee 变成 https://aaa/bbb/ddd/eee

只要修改下 nginx ,适应各种奇葩情况

当然如果改起来麻烦

# 还是要优先处理的

有赞:

你这里是 # hash路由吗?这种的话,在聊天窗口或者内置浏览器会被截断,建议改一下你的路由方式,用 history 路由 www.abc.com/a/b/c?id=xxx

-EOF-

AI助手支持GPT4.0