async initData() {
const res = await uni.request({
url: 'interfaces/index/index', // 替换为真实API地址
method: 'GET',
header: {
'Content-Type': 'application/json',
},
success: (res) => {
if (res.code === 200) {
const data = res.data
const last_page = data.last_page
this.haveMoreData = this.currentPage < last_page
if (this.currentPage === 1) {
this.list = data.data
} else {
this.list = this.list.concat(data.data)
}
this.list.forEach(item => {
if (!item.picurl || item.picurl.trim() === '') {
item.picurl =
'https://pic3.58cdn.com.cn/p1/big/n_v399070eb97c2344a7acc5d6f97a02f27c.jpg';
}
})
setTimeout(() => {
this.list = this.list
})
console.log("list=======", JSON.stringify(this.list));
}
},
fail: (error) => {
console.log("list===error====", JSON.stringify(error));
},
});}
0 个回复