antPro编译后,使用nginx代理,nginx配置如下:
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root C:\project_name\dist;
index index.html index.htm;
}
location ^~/api/ {
proxy_pass http://192.168.33.33:9999/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
api文件中,写的类似如下:
export async function queryGoods() {
return request('/api/order/getgoods/');
}
在网上也查了很多相关资料,解决方法大致是:
1、在package.json中增加homepage字段;
2、把路由方式改成hash;
但以上两点,都没起什么作用,请问我到底该如何配置?
谢谢大家了。