zhengyiming
2 天以前 ffe6d39f01a92b9e71ccb14038cfd337d0b166ca
apps/cMiniApp/src/custom-tab-bar/index.tsx
@@ -29,7 +29,8 @@
const TarBarItem = function (props: TarBarItemProps, context: SetupContext<TarBarItemEvents>) {
  const _badge = props.badge > 99 ? '99+' : props.badge;
  const isActive = props.currentPath.toLowerCase().includes(props.pagePath.toLowerCase());
  // const isActive = props.currentPath.toLowerCase().includes(props.pagePath.toLowerCase());
  const isActive = props.active;
  return (
    <div
      class={['bottom-tab-item', { active: isActive }, props.className]}
@@ -67,8 +68,10 @@
    const isLogin = useIsLogin();
    const loginTipShowed = ref(false);
    const isClicking = ref(false);
    const switchTab = (url: string, index: number) => {
      if (isClicking.value) return;
      if (!isLogin.value && whitePageList.every((x) => x !== url)) {
        if (!loginTipShowed.value) {
          loginTipShowed.value = true;
@@ -84,9 +87,14 @@
        }
        return;
      }
      Taro.switchTab({ url }).then(() => {
        system.setTabIndex(index);
      });
      isClicking.value = true;
      Taro.switchTab({ url })
        .then(() => {
          system.setTabIndex(index);
        })
        .finally(() => {
          isClicking.value = false;
        });
    };
    function goPublish() {
@@ -112,6 +120,7 @@
    }
    return () => {
      const _router = Taro.useRouter();
      return (
        <View
          class="bottom-tab"
@@ -124,7 +133,7 @@
            icon="../assets/tabbar/icon-home.png"
            activeIcon="../assets/tabbar/icon-home-active.png"
            pagePath={TabBarPageRouter.Home}
            currentPath={router.path}
            currentPath={_router.path}
            index={0}
            active={system.activeTab === 0}
            className="home"
@@ -136,7 +145,7 @@
            icon="../assets/tabbar/icon-task.png"
            activeIcon="../assets/tabbar/icon-task-active.png"
            pagePath={TabBarPageRouter.Task}
            currentPath={router.path}
            currentPath={_router.path}
            active={system.activeTab === 1}
            className="task"
            onClick={switchTab}
@@ -147,7 +156,7 @@
            icon="../assets/tabbar/icon-mine.png"
            activeIcon="../assets/tabbar/icon-mine-active.png"
            pagePath={TabBarPageRouter.Mine}
            currentPath={router.path}
            currentPath={_router.path}
            active={system.activeTab === 2}
            className="mine"
            onClick={switchTab}