直播列表tab页切换bug

This commit is contained in:
xuwenbo
2020-09-14 07:58:28 +08:00
parent 1afb0ce5f8
commit 68680e38b1

View File

@ -79,10 +79,28 @@
methods: { methods: {
// 切换tab // 切换tab
selTab(tab) { selTab(tab) {
console.log(tab)
this.tabCur = tab.title; this.tabCur = tab.title;
this.liveStatus = tab.code; this.liveStatus = tab.code;
this.liveList = []; this.liveList = [];
this.getLiveList(); this.loaded=false;
this.loading=false;
this.getLiveListTab();
},
// 直播列表
getLiveListTab() {
let that = this;
yxWechatLive({
liveStatus: that.liveStatus,
page: 0,
size: that.size
}).then(res => {
that.liveList = [...that.liveList, ...res.data.content];
that.lastPage = res.data.lastPage;
this.loaded = res.data.content.length < that.size;
this.loading = false;
});
}, },
// 直播列表 // 直播列表
getLiveList() { getLiveList() {
@ -90,20 +108,14 @@
if (this.loading || this.loaded) return; if (this.loading || this.loaded) return;
this.loading = true; this.loading = true;
yxWechatLive({ yxWechatLive({
liveStatus: that.liveStatus, liveStatus: this.liveStatus,
page: that.currentPage, page: this.currentPage,
size: that.size size: this.size
}).then(res => { }).then(res => {
that.liveList = that.liveList.concat(res.data.content) that.liveList = that.liveList.concat(res.data.content)
this.currentPage++; this.currentPage++;
this.loaded = res.data.content.length < that.size; this.loaded = res.data.content.length < that.size;
this.loading = false; this.loading = false;
// if (that.currentPage < res.data.lastPage) {
// that.loadStatus = '';
// } else {
// that.loadStatus = 'over';
// }
}); });
} }
}, },