"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Math) {
  Icon();
}
const Icon = () => "../icon/index.js";
const activeColor = "#1d2089";
const inactiveColor = "#999";
const _sfc_main = {
  __name: "index",
  setup(__props) {
    const tabList = [
      {
        iconName: "icon-shouye",
        text: "首页",
        pagePath: "pages/index/index"
      },
      {
        iconName: "icon-zuanshi",
        text: "产品",
        pagePath: "pages/product/index"
      },
      {
        iconName: "icon-zhifeiji",
        text: "活动",
        pagePath: "pages/activity/index"
      },
      {
        iconName: "icon-qizhi",
        text: "基(营)地",
        pagePath: "pages/base/index"
      },
      {
        iconName: "icon-renyuan",
        text: "我的",
        pagePath: "pages/my/index"
      }
    ];
    const currentPath = common_vendor.ref("");
    const updateCurrentPath = () => {
      const pages = getCurrentPages();
      const currentPage = pages[pages.length - 1];
      currentPath.value = currentPage ? currentPage.route : "";
    };
    const switchTab = (item) => {
      if (currentPath.value === item.pagePath)
        return;
      common_vendor.index.switchTab({
        url: `/${item.pagePath}`
      });
    };
    common_vendor.index.$on("onShow", () => {
      updateCurrentPath();
    });
    common_vendor.onMounted(() => {
      updateCurrentPath();
    });
    common_vendor.onUnmounted(() => {
      common_vendor.index.$off("onShow");
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(tabList, (item, index, i0) => {
          return common_vendor.e({
            a: item.iconName
          }, item.iconName ? {
            b: "0e399a7b-0-" + i0,
            c: common_vendor.p({
              name: item.iconName,
              size: 48,
              color: currentPath.value === item.pagePath ? activeColor : inactiveColor
            })
          } : {}, {
            d: common_vendor.t(item.text),
            e: currentPath.value === item.pagePath ? activeColor : inactiveColor,
            f: index,
            g: currentPath.value === item.pagePath ? 1 : "",
            h: common_vendor.o(($event) => switchTab(item), index)
          });
        }),
        b: common_vendor.gei(_ctx, "")
      };
    };
  }
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0e399a7b"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/tabbar/index.js.map
