"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
;/* empty css                                               */
;/* empty css                                                        */
;/* empty css                                                */
;/* empty css                                               */
;/* empty css                                               */
;/* empty css                                                  */
;/* empty css                                                */
;/* empty css                                                        */
const Vue = require("vue");
const index = require("../../../../node_modules/vant/es/dropdown-menu/index.js");
const index$1 = require("../../../../node_modules/vant/es/dropdown-item/index.js");
const _sfc_main = {
  __name: "DropdownMenu",
  props: {
    modelValue: {
      type: Object,
      default: {}
    },
    options: {
      type: Array,
      default: []
    }
  },
  emits: ["update:modelValue", "change"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const activeObj = Vue.computed({
      get: () => {
        return props.modelValue;
      },
      set: (val) => {
        emit("update:modelValue", val);
      }
    });
    function changeItem(value, item) {
      emit("change", { ...activeObj.value });
    }
    function changeClick(value, item) {
      emit("clickItem", { value, item, ...activeObj.value });
    }
    return (_ctx, _cache) => {
      const _component_van_dropdown_item = index$1.DropdownItem;
      const _component_van_dropdown_menu = index.DropdownMenu;
      return Vue.openBlock(), Vue.createBlock(_component_van_dropdown_menu, Vue.mergeProps(_ctx.$attrs, {
        "swipe-threshold": "4",
        "auto-locate": ""
      }), {
        default: Vue.withCtx(() => [
          (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(__props.options, (item) => {
            return Vue.openBlock(), Vue.createBlock(_component_van_dropdown_item, {
              modelValue: Vue.unref(activeObj)[item.name],
              "onUpdate:modelValue": ($event) => Vue.unref(activeObj)[item.name] = $event,
              title: item.title,
              options: item.options,
              teleport: "body",
              onChange: (value) => changeItem(),
              onClick: (value) => changeClick(value, item)
            }, null, 8, ["modelValue", "onUpdate:modelValue", "title", "options", "onChange", "onClick"]);
          }), 256))
        ]),
        _: 1
      }, 16);
    };
  }
};
exports.default = _sfc_main;
