uniApp浏览器调试跨域解决办法

/ 0评 / 0

在manifest.json文件映射一下;点击源码视图,h5部分加上:

"devServer" : {
	"port" : 8085,
	"disableHostCheck" : true,
	"proxy" : {
		"/api" : {
			"target" : "http://api.test.com",
		         "ws": true,
			"changeOrigin": true,
			"pathRewrite": {
				"^/api": ""
			}
		}
	}
}

baseUrl : 'api'

如有错误,欢迎留言纠正!

发表评论

您的电子邮箱地址不会被公开。