uiapp vue 跨域问题 代理
uniapp目录下源码如下
"h5" : {
"devServer" : {
"port" : "",
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "http://172.16.6.21:8080", //设置代理的ip
"changeOrigin" : true,
"pathRewrite" : {
"^/api" : "" //相当于http://172.16.6.21:8080的简写
}
}
}
}
}
使用
** vue**
新建
module.exports = {
devServer: {
//设置代理
proxy: {
'/api' : {
target: "http://localhost:8888",//域名
changeOrigin: true,//开启代理
pathRewrite: {
'^/api' : '/'
}
}
}
}
};
使用