UNPKG

yanzhen-design-vue

Version:

83 lines (82 loc) 2.97 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); const section = require("./section.cjs"); const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: section.sectionName }, __name: "section", props: section.sectionProps, emits: section.sectionEmits, setup(__props, { expose: __expose, emit: __emit }) { const { class: wrapClass } = section.sectionOptions; const props = __props; const emit = __emit; const valueArray = vue.computed(() => { const { value } = props; return value && value.includes(",") ? value.split(",") : [props.defaultValue, props.defaultValue]; }); const emitUpdateValue = (value) => { emit("update:value", value); emit("change", value); }; const handleUpdateValue1 = (value) => { const vValue = `${value},${valueArray.value[1] ?? ""}`; emitUpdateValue(vValue); }; const handleUpdateValue2 = (value) => { const vValue = `${valueArray.value[0] ?? ""},${value}`; emitUpdateValue(vValue); }; const slots = vue.useSlots(); const slotKeys = Object.keys(slots); const _ref1 = vue.ref(); const _ref2 = vue.ref(); __expose({ ref1: _ref1, ref2: _ref2 }); return (_ctx, _cache) => { const _component_a_input_number = vue.resolveComponent("a-input-number"); return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [ vue.createVNode(_component_a_input_number, vue.mergeProps({ ref_key: "_ref1", ref: _ref1, class: [vue.unref(wrapClass)], placeholder: "请输入" }, _ctx.$attrs, { value: valueArray.value[0], onChange: handleUpdateValue1 }), vue.createSlots({ _: 2 }, [ vue.renderList(vue.unref(slotKeys), (slot) => { return { name: slot, fn: vue.withCtx((slotItem) => [ vue.renderSlot(_ctx.$slots, slot, vue.normalizeProps(vue.guardReactiveProps(slotItem))) ]) }; }) ]), 1040, ["class", "value"]), _cache[0] || (_cache[0] = vue.createTextVNode(" ~ ")), vue.createVNode(_component_a_input_number, vue.mergeProps({ ref_key: "_ref2", ref: _ref2, class: [vue.unref(wrapClass)], placeholder: "请输入" }, _ctx.$attrs, { value: valueArray.value[1], onChange: handleUpdateValue2 }), vue.createSlots({ _: 2 }, [ vue.renderList(vue.unref(slotKeys), (slot) => { return { name: slot, fn: vue.withCtx((slotItem) => [ vue.renderSlot(_ctx.$slots, slot, vue.normalizeProps(vue.guardReactiveProps(slotItem))) ]) }; }) ]), 1040, ["class", "value"]) ], 64); }; } }); exports.default = _sfc_main;