/* empty css                                               */
/* empty css                                               */
/* empty css                                                */
/* empty css                                               */
/* empty css                                                    */
import { createElementBlock, openBlock, createCommentVNode, createVNode, createElementVNode, toDisplayString, withCtx, Fragment, renderList, createBlock, normalizeClass } from "vue";
import emitter from "../../../utils/eventBus.mjs";
/* empty css               */
import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
import { Grid } from "../../../../node_modules/vant/es/grid/index.mjs";
import { GridItem } from "../../../../node_modules/vant/es/grid-item/index.mjs";
import { Icon } from "../../../../node_modules/vant/es/icon/index.mjs";
const _hoisted_1 = { class: "menu-grid-wrap" };
const _hoisted_2 = {
  key: 0,
  class: "menu-header"
};
const _hoisted_3 = { class: "header-left" };
const _hoisted_4 = { class: "header-title" };
const _hoisted_5 = {
  key: 0,
  class: "header-right"
};
const _hoisted_6 = { class: "more-btn" };
const _hoisted_7 = { class: "menu-item" };
const _hoisted_8 = ["src"];
const _hoisted_9 = {
  key: 1,
  class: "icon-text"
};
const _hoisted_10 = { class: "menu-text" };
const _sfc_main = {
  __name: "MenuGrid",
  props: {
    title: {
      type: String,
      default: ""
    },
    showHeader: {
      type: Boolean,
      default: true
    },
    showMore: {
      type: Boolean,
      default: true
    },
    moreText: {
      type: String,
      default: ""
    },
    columnNum: {
      type: Number,
      default: 5
    },
    menuItems: {
      type: Array,
      default: () => []
    }
  },
  setup(__props) {
    function clickHandler(item) {
      console.log("🚀 ~ clickHandler ~ item:", item);
      emitter.emit("loadPage", item.pageId);
    }
    return (_ctx, _cache) => {
      const _component_van_icon = Icon;
      const _component_van_grid_item = GridItem;
      const _component_van_grid = Grid;
      return openBlock(), createElementBlock("div", _hoisted_1, [
        __props.showHeader ? (openBlock(), createElementBlock("div", _hoisted_2, [
          createElementVNode("div", _hoisted_3, [
            createElementVNode("span", _hoisted_4, toDisplayString(__props.title), 1)
          ]),
          __props.showMore ? (openBlock(), createElementBlock("div", _hoisted_5, [
            createElementVNode("span", _hoisted_6, toDisplayString(__props.moreText), 1),
            createVNode(_component_van_icon, {
              name: "arrow",
              class: "more-icon"
            })
          ])) : createCommentVNode("", true)
        ])) : createCommentVNode("", true),
        createVNode(_component_van_grid, {
          "column-num": __props.columnNum,
          border: "false",
          class: "menu-grid"
        }, {
          default: withCtx(() => [
            (openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuItems, (item, index) => {
              return openBlock(), createBlock(_component_van_grid_item, {
                key: index,
                onClick: ($event) => clickHandler(item)
              }, {
                default: withCtx(() => [
                  createElementVNode("div", _hoisted_7, [
                    createElementVNode("div", {
                      class: normalizeClass(["icon-box", item.bgClass || "icon-blue"])
                    }, [
                      item.iconType === "image" ? (openBlock(), createElementBlock("img", {
                        key: 0,
                        src: item.icon,
                        class: "icon-img"
                      }, null, 8, _hoisted_8)) : item.iconText ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(item.iconText), 1)) : (openBlock(), createBlock(_component_van_icon, {
                        key: 2,
                        name: item.icon || "apps-o"
                      }, null, 8, ["name"]))
                    ], 2),
                    createElementVNode("div", _hoisted_10, toDisplayString(item.label), 1)
                  ])
                ]),
                _: 2
              }, 1032, ["onClick"]);
            }), 128))
          ]),
          _: 1
        }, 8, ["column-num"])
      ]);
    };
  }
};
const _MenuGrid = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cf276af8"]]);
export {
  _MenuGrid as default
};
