uni.request({
url: 'http://127.0.0.1:8881/uniapplogin',
data: {
input: e.detail.value.input,
input1: e.detail.value.input1
},
header: {
'custom-header': 'hello' //自定义请求头信息
}
"devServer" : {
"https" : false,
"disableHostCheck" : true,
"port" : 8881, // 你的端口
"proxy" : {
"/uniapplogin" : {
"target" : "http://127.0.0.1", // 服务器地址
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/uniapplogin" : ""
}
}
}
}
Access-Control-Allow-Origin:
* // 有些时候上面的 允许所有请求 依旧会被拦截下来,所以建议用下面这种,允许来自127.0.0.1:3000 的请求,其他的就拒绝
Access-Control-Allow-Origin:127.0.0.1:3000
欢迎光临 精易论坛 (https://125.confly.eu.org/) | Powered by Discuz! X3.4 |