跨域:多ip,多端口情況需要考慮配置
index中的Dev->module.exports需添加一下配置
proxyTable: {
'/apis':{ // 要代理的接口名
target:'http://127.0.0.1:9528/', // 要代理的接口地址
changeOrigin: true, // 允許跨域
pathRewrite: {
'^/apis':'/'
}
}
},
使用接口
let url = "/apis/function"