You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
560 B
28 lines
560 B
3 years ago
|
function getData(params) {
|
||
|
// 开始的时候进行动画加载中
|
||
|
uni.showLoading({
|
||
|
title:"加载中"
|
||
|
})
|
||
|
return new Promise((resolve, reject) => {
|
||
|
console.log(params);
|
||
|
uni.request({
|
||
|
...params,
|
||
|
// header: {
|
||
|
// 'Content-Type': "application/json;charset=UTF-8"//自定义请求头信息
|
||
|
// },
|
||
|
success: (res) => {
|
||
|
resolve(res)
|
||
|
},
|
||
|
fail(error) {
|
||
|
console.log(error);
|
||
|
},
|
||
|
complete(res){
|
||
|
uni.hideLoading()
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
|
||
|
// 无论请求成功或者失败 都会进complete 这个函数
|
||
|
}
|
||
|
export default getData
|