vue history模式怎样去掉URL中的#号

lishengyu 501 0

其次要确定静态文件是放在主域名下还是二级域名下 比如网址为www.baidu/home 即为主域名,此时我们将打包的静态文件放在此域名的根目录下时只需在nginx文件中添加

location / {
                // 此行在这个最下面            
                if (!-e $request_filename) {
                        rewrite ^/(.*) /index.html last;
                        break;
                }
        }

若为二级域名(www.baidu/test/home)则我们需要修改两个位置 1.router.js文件中mode下面添加

base:”test"

2.nginx

location /test/ {
                // 此行在这个最下面            
             if (!-e $request_filename) {
                rewrite ^/(.*) /test/index.html last;
                break;
            }
        }

发表评论 取消回复
表情 图片 链接 代码

分享