uni-App:
接口调用:
get方式:
function() {
// 发起请求
uni.request({
url: '/captcha/sent?m=1', //接口地址,通过?可以传递,或者{}。
method:"GET",
success: (res) => {
console.log(res)
}
});
}
post方式:
function() {
// 发起请求
uni.request({
url: '/captcha/sent', //接口地址。
method:"POST",
header: {
'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息
},
data: { //后端要求的参数 //post必须通过data{}
phone: 123,
},
success: (res) => {
console.log(res)
}
});
}