uniapp本地运行在浏览器端,报跨域错误解决方案
根目录下找到manifest.json文件,点源码视图,添加h5配置后重新运行即可:
"h5" : {
"devServer" : {
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "http://youDomain",
"changeOrigin" : true,
"secure" : false,
"ws": false,
"pathRewrite" : {
"^/api" : ""
}
}
}
}
}