proxy只是解决了开发环境的跨域,线上依然会产生跨域的问题。上线时需要配置nginx!
location ^~ /prod-api/ { proxy_pass http://xxxxxx.com:6655/; // 这个地址,是你的api的地址 }