dev-server能在开发环境中生成一个本地服务器来实现代理
在vue-cli下 找的 dev下的
proxyTable: {
'/':{ //前缀
target: 'http://www.example.com',
changeOrigin:true
}
},
请求的时候
axios.get('/salt/index')
实际请求就是
http://www.example.com/salt/index
这样页面就不会报 跨域的提示了