uniapp跨域问题

业务代码使用

uni.request({
					url: '/api/user/getFaceRecord?pageNo=1&pageSize=10&name=王&IDCard=340111199001201511',
					data: this.sParams,
					// header: {
					// 	'Authorization': 'Bearer 28e323ade10334b2b65ccbe1e1e9ab24',
					// },
					success: (result) => {
						this.list = result.data.data.dataList
						let stadiumsArr = result.data.data
						this.pageCount = stadiumsArr.pageCount
					}
				});

跨域配置:manifast.json

 "h5" : {
        "title" : "名称",
        "domain" : "",
        "router" : {
            "mode" : "history"
        },
		"devServer": {
		            "proxy": {
		                "/api/user/getFaceRecord": {
		                    "target": "http://localhost:8055",
		                    "pathRewrite": {
		                        "^/api": ""
		                    }
		                }
		            }
		        }
		
    }

关键点来了,要想生效,要重启浏览器或者浏览器调试控制台关闭重新打开才行

你可能感兴趣的:(js)