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要相互对应
posted @ 2020-07-08 18:07  唯爱金生  阅读(9714)  评论(0编辑  收藏  举报