去除Vue访问链接含有#号解决方案

微信开发,vue-cli 进行项目开发的时候,Vue 跳转的url含有#号,有时候在授权的时候很受影响,那么就想找个方法把#号去除掉。

 

原效果:

 

解决方案:

1、在路由表中设置一个属性和参数 mode:'history'

 

2、配置Nginx 

location / {
  root /Users/Zion/Sites/vant/dist/; 
  index index.html index.htm;
  try_files $uri $uri/ /index.html;
}
 
注意:/Users/Zion/Sites/vant/dist/  这个目录为vue-cli打包的本地目录地址,这个自行更改成自己的目录地址
 
 
3、打包访问
 

 

 解答文章 :官方链接

 

posted @ 2019-03-05 17:43  Zion0707  阅读(5080)  评论(0编辑  收藏  举报