uni.request post请求后端获取不到数据

是她丫

关注

阅读 87

2022-03-12

传递参数到后端,后端却获取不到前端数据

uni.request({
			method:'POST',
			url: "http://127.0.0.1:3000/api/login",
			data:{
				username: this.username,
				password: this.password
			},
			success:(res)=> {
				console.log(res);
			}
		})

解决方式:

设置请求头Content-type
header:{
	'Content-type':'application/x-www-form-urlencoded'
},

相关推荐

精彩评论(0)

0 0 举报