7***@qq.com
7***@qq.com
  • 发布:2023-06-28 15:16
  • 更新:2023-06-29 09:19
  • 阅读:140

tabbar切换图标

分类:uni-app

底部tabbar每次切换图片都会闪烁一次

2023-06-28 15:16 负责人:无 分享
已邀请:
爱豆豆

爱豆豆 - 办法总比困难多

你用的是自定义tabbar吧?

2***@qq.com

2***@qq.com - 程序世界

自定义应该怎么解决这个问题呢

yoosha

yoosha

做成一个组件RootBase, 用vuex控制当前选中tab

<template>  
  <view>  
    <slot />  
    <!-- tabbar -->  
    <tabbar.....>  
  </view>  
</template>  
export default {  
   computed: {  
     ...mapState('tab', ["selectedIndex"])  
   },  
  methods: {  
    ...mapMutations('tab', ["setTabSelectIndex"])  
  }  
}

各个tabbar页面根节点换成

 <RootBase>  
     <!--  tab页面内容.... -->  
</RootBase>

要回复问题请先登录注册