时好时坏,有时能get,有时不能,浏览器直连的时候是正常的,
/*获取排行榜 */
let index = 0;
let resultArr = [];
while(index < 5){
let topListData = await request("/top/list",{idx:index++})
let topListItem = {name:topListData.playlist.name,tracks:topListData.playlist.tracks.slice(0,3)};
resultArr.push(topListItem);
this.setData({
topList:resultArr
})
}
===================request.js============================
import config from "./config";
export default(url,data={},method="GET")=>{
return new Promise((resolve, reject) => {
wx.request({
url:config.host+url,
data,
method,
success:(res)=>{
console.log("请求成功",res);
resolve(res.data);
},
fail: (err)=> {
console.log("请求失败",err);
reject(err);
}
})
})
}
400 是后端参数校验问题 找他们