uniapp 跨域 报错提示 Access to XMLHttpRequest at

错误提示

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要相互对应

uniapp 跨域 报错提示 Access to XMLHttpRequest at

上一篇:ajax和axios、fetch的区别(项目概述)


下一篇:vue axios请求频繁时取消上一次请求