refactor: 🎨 优化我的收藏和足迹代码

master
Yer 2023-05-24 16:54:15 +08:00
parent f31ff79a39
commit 1c938e0007
2 changed files with 23 additions and 9 deletions

View File

@ -107,20 +107,33 @@
}; };
}, },
onShow() { onShow() {
this.getGoodList(); this.fetchReloadOrNextPage('reload')
this.getStoreList();
}, },
onReachBottom() { onReachBottom() {
if (this.tabCurrentIndex == 0) { this.fetchReloadOrNextPage('next')
this.navList[0].params.pageNumber++;
this.getGoodList();
} else {
this.navList[1].params.pageNumber++;
this.getStoreList();
}
}, },
methods: { methods: {
//
fetchReloadOrNextPage(type) {
if(type == 'next'){
this.navList[this.tabCurrentIndex].params.pageNumber ++;
if (this.tabCurrentIndex == 0) {
this.getGoodList();
} else {
this.getStoreList();
}
}
else{
this.navList[0].params.pageNumber = 1;
this.navList[1].params.pageNumber = 1;
this.goodList = [];
this.storeList = [];
this.getGoodList();
this.getStoreList();
}
},
/** /**
* 打开商品左侧取消收藏 * 打开商品左侧取消收藏
*/ */

View File

@ -77,6 +77,7 @@
this.getList(); this.getList();
}, },
onShow() { onShow() {
this.params.pageNumber = 1
this.trackList = []; this.trackList = [];
this.getList(); this.getList();
}, },