优化message

This commit is contained in:
TOP糯米 2023-04-08 16:30:24 +08:00
parent 10294c3939
commit 7a8e0455ba
1 changed files with 15 additions and 10 deletions

View File

@ -39,6 +39,7 @@ export default {
return {
utils: this.$utils,
bodyPt: 0,
loaded: false,
timer: null,
tabIndex: 0,
tabHeight: 0,
@ -53,12 +54,13 @@ export default {
messageTabIndex: (state) => state.system.messageTabIndex,
}),
},
onLoad() {},
async onShow() {
if (this.messageTabIndex != this.tabIndex || (this.messageTabIndex == 0 && this.tabIndex == 0)) {
this.tabList = [];
await this.loadCate();
this.switchTab(this.messageTabIndex);
async onLoad() {
await this.loadCate();
this.switchTab(this.tabIndex);
},
onShow() {
if (this.messageTabIndex != this.tabIndex) {
this.tabIndex = this.messageTabIndex;
}
this.$store.commit("system/refreshOrder", true);
},
@ -80,10 +82,11 @@ export default {
currentTab.page = 1;
currentTab.list = [];
currentTab.more = true;
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.loadList(index);
}, 100);
uni.pageScrollTo({
scrollTop: 0,
duration: 0,
});
this.loadList(index);
},
setTabHeight() {
let query = uni.createSelectorQuery().in(this);
@ -98,6 +101,7 @@ export default {
* 加载分类
*/
async loadCate() {
if (this.loaded) return;
await this.$models.system.notifyCate().then((cate) => {
cate.forEach((item) => {
this.tabList.push({
@ -108,6 +112,7 @@ export default {
list: [],
});
});
this.loaded = true;
});
},
/**