解决h5不触发swiper的change事件

This commit is contained in:
TOP糯米 2023-04-14 14:50:38 +08:00
parent e6bd059d9f
commit 0a2ca00069
2 changed files with 14 additions and 0 deletions

View File

@ -131,7 +131,14 @@ export default {
this.switchTab(this.tabIndex); this.switchTab(this.tabIndex);
} }
if (this.getTabIndex != this.tabIndex) { if (this.getTabIndex != this.tabIndex) {
// #ifdef H5
setTimeout(() => {
this.tabIndex = this.getTabIndex; this.tabIndex = this.getTabIndex;
}, 10);
// #endif
// #ifndef H5
this.tabIndex = this.getTabIndex;
// #endif
} }
}, },
onReady() {}, onReady() {},

View File

@ -119,7 +119,14 @@ export default {
this.switchTab(this.tabIndex); this.switchTab(this.tabIndex);
} }
if (this.orderTabIndex != this.tabIndex) { if (this.orderTabIndex != this.tabIndex) {
// #ifdef H5
setTimeout(() => {
this.tabIndex = this.orderTabIndex; this.tabIndex = this.orderTabIndex;
}, 10);
// #endif
// #ifndef H5
this.tabIndex = this.orderTabIndex;
// #endif
} }
}, },
onReady() {}, onReady() {},