UNPKG

@fecp/mobile

Version:

70 lines (69 loc) 3.26 kB
/* empty css */ /* empty css */ /* empty css */ /* empty css */ /* empty css */ /* empty css */ /* empty css */ /* empty css */ import { computed, createBlock, openBlock, mergeProps, withCtx, createElementBlock, Fragment, renderList, unref } from "vue"; import { DropdownMenu } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dropdown-menu/index.mjs"; import { DropdownItem } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dropdown-item/index.mjs"; 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 = 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 = DropdownItem; const _component_van_dropdown_menu = DropdownMenu; return openBlock(), createBlock(_component_van_dropdown_menu, mergeProps(_ctx.$attrs, { "swipe-threshold": "4", "auto-locate": "" }), { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item) => { return openBlock(), createBlock(_component_van_dropdown_item, { modelValue: unref(activeObj)[item.name], "onUpdate:modelValue": ($event) => 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); }; } }; export { _sfc_main as default };