使用 hash 来实现前端路由, url 中带有#作锚点,PC端跳转的链接都正常,但是移动端解析地址时#发生了转码,在IOS中将#解析成了%23使得跳转异常,就会出现下面的 url
http://192.50.11.19/h5.html%23/adminrelease?appParam=eyAgIniAiMjQ0MTM3NTdiY5ZGVmOWE5ZDRiMGUiLCAgIm90aGVW0iIDogeyAgICAiZnJvbVdheSIgOiAibW9iaWxlGVldElkIiA6ICJwQVIwdklqayIgIH19
考虑对url做兼容,修改 nginx 配置文件如下
location / {
root /usr/local/nginx/html/dist;
rewrite ^(.*)\#(.*)$ $1#$2 redirect;
index index.html index.htm;
}