Vue 打包出来的dist/index.html本质是一个文件,所以直接打开的请求会变成file协议,不是http,所有要用代理,比如nginx:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /api {
proxy_pass http://cccc/yzqxApp/dfdff;
}
}