收藏
回答

自定义 tabbar 切换 tabbar 时页面闪烁问题解决了吗?

我的天都 2025 年了好像自定义 tabbar 切换时整个 tabbar 会消失,然后再重新渲染导致的 tabbar 闪烁,官方就不能提供一个解决方案嘛,我看从 19年一致到 25年 马上都要 26 年了这个问题还不处理吗?

回答关注问题邀请回答
收藏

4 个回答

  • sunshine boy
    sunshine boy
    03-11

    不知道和你的问题一样不一样,我这边也是闪烁问题,但是我通过useEffect解决了,相关代码如下:

    const [selected, setSelected] = useState(0)

    const currTabBelongTo = useRef<any>(null)

      useEffect(() => {

        const pageObj = Taro.getCurrentInstance().page || {} as any

        if (!currTabBelongTo.current) {

          currTabBelongTo.current = pageObj.route

          // 根据当前路由高亮

          const index = tabList.findIndex((item: any) => item.pagePath === '/' + currTabBelongTo.current)

          setSelected(index)

        }

      }, [])

    其中selected就是控制自定义tab高亮的。

    希望对你有帮助。



    03-11
    有用 1
    回复
  • 贾公子
    贾公子
    02-26

    我比较好奇为啥vant好像不闪烁

    https://developers.weixin.qq.com/s/7nj0Fcmk8u75


    02-26
    有用
    回复
  • 从君华
    从君华
    发表于小程序端
    2025-11-22

    这个目前为止应该是无解的

    2025-11-22
    有用
    回复 1
    • .
      .
      发表于移动端
      2025-11-22
      目前看起来是这样的
      2025-11-22
      回复
  • 启年
    启年
    2025-11-22

    搜搜其他帖子,看看怎么着缝缝补补能用起来吧。

    2025-11-22
    有用
    回复 1
    • .
      .
      发表于移动端
      2025-11-22
      是的 只能到处试
      2025-11-22
      回复
登录 后发表内容