Access to XMLHttpRequest at`

manifest.json文件修改

"h5": {
        "devServer": {
            "port": 8000,
            "disableHostCheck": true,
            "proxy": {
                "/XXX": {
                    "target": "http://域名",
                    "changeOrigin": true,
                    "secure": false,
                    "pathRewrite":{"^/XXX":""}
                }
            }
        }
    }

http请求

uni.request({
      url: '/XXX/具体方法',
	data:{
		id: 123
	},		
	success: (res) => {
	      console.log(res.data);
	}
});
*XXX要相互对应

相关文章:

  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-04-10
  • 2021-11-16
  • 2021-06-18
  • 2022-12-23
猜你喜欢
  • 2021-09-12
  • 1970-01-01
  • 2021-09-20
  • 2022-02-06
  • 2021-07-04
  • 2022-12-23
  • 2021-08-20
相关资源
相似解决方案