添加消息无数据提示

This commit is contained in:
2020-08-24 15:13:38 +08:00
parent 6306573ee4
commit 0a5115b8f4
3 changed files with 45 additions and 13 deletions

View File

@@ -18,6 +18,7 @@
</view>
</view>
</view>
<u-loadmore :status="loadStatus" bg-color="#ECECEC" margin-top="20" @loadmore="loadmore" />
</view>
</template>
@@ -26,20 +27,45 @@
data() {
return {
actives: [],
page: 1
page: 1,
timer: true,
loadStatus: 'loadmore'
};
},
onLoad() {
this.getCartList();
},
},
onReachBottom() {
this.loadmore();
},
methods: {
getCartList() {
this.$u.post("message/orderDeliveryList",{page: this.page}).then(res => {
console.log(res.data.data)
if (res.errCode == 0) {
this.actives = res.data.data;
}
})
loadmore() {
if(!this.timer) return false;
this.loadStatus = "loading";
this.page++;
this.getCartList({ load: 'loadmore' }).then(length => {
if(length == 0) {
this.page--;
this.loadStatus = 'nomore';
} else {
this.loadStatus = 'loading';
}
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
})
},
async getCartList({ load = 'reload' } = {}) {
const res = await this.$u.post("message/orderDeliveryList",{ page: this.page })
this.timer = true;
if (res.errCode == 0) {
if(load == 'reload') {
this.actives = res.data.data;
if(res.data.data.length < 12) this.loadStatus = "nomore";
}
else if(load == 'loadmore') this.actives.push(...res.data.data);
}
return res.data.data.length;
},
viewLogistics(item) {
let url;