解决方案
用一个大页面, 包含其他tab小页面, 从而解决闪烁问题
// 组件端接收
props: {
currentPagePath: null
},
<cloudPlatform ref="clouddata" v-show="showMeunType === 'cloudPlatform'" />
<index3 v-show="showMeunType === 'index3'" />
<myhome ref="homedata" v-show="showMeunType === 'myhome'"></myhome>
<!--调用组件 通过这里的type 向tabbar组件传值 -->
<custom-tab-bar :currentPagePath="type" @tabCut="tabCut"></custom-tab-bar>
tabCut(type) {
if (type == 0) {
uni.pageScrollTo({
scrollTop: 0,
duration: 1 // 滚动持续时间,单位为毫秒
});
this.type = type;
this.showMeunType = 'index3';
this.denglu();
}
}