UNPKG

@wocwin/t-ui-plus

Version:

Page level components developed based on Element Plus.

91 lines (88 loc) 2.81 kB
import { defineComponent, computed, ref, resolveComponent, createBlock, openBlock, mergeProps, withCtx, renderSlot, createElementBlock, Fragment, renderList, resolveDynamicComponent, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString } from 'vue'; var _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: "TCheckbox" }, __name: "index", props: { type: { type: String, validator: (value) => ["check", "button"].includes(value), default: "check" }, options: { type: Array, default: () => [] }, size: { type: String, validator: (value) => ["large", "default", "small"].includes(value), default: "default" }, border: { type: Boolean, default: false }, props: { type: Object, default: () => ({}) } }, setup(__props) { const checkProps = __props; const checkType = computed(() => { var _a; const obj = { check: "el-checkbox", button: "el-checkbox-button" }; return (_a = obj[checkProps.type]) != null ? _a : "el-checkbox"; }); const optionsProps = ref({ ...{ value: "value", label: "label", disabled: "disabled" }, ...checkProps.props }); return (_ctx, _cache) => { const _component_el_checkbox_group = resolveComponent("el-checkbox-group"); return openBlock(), createBlock(_component_el_checkbox_group, mergeProps(_ctx.$attrs, { size: __props.size }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default", {}, () => [ (openBlock(true), createElementBlock( Fragment, null, renderList(__props.options, (item, index) => { return openBlock(), createBlock(resolveDynamicComponent(checkType.value), mergeProps(item, { key: index, value: item[optionsProps.value.value], border: __props.border, disabled: item[optionsProps.value.disabled] }), { default: withCtx(() => [ renderSlot(_ctx.$slots, item.slot, normalizeProps(guardReactiveProps(item)), () => [ createTextVNode( toDisplayString(item[optionsProps.value.label]), 1 /* TEXT */ ) ]) ]), _: 2 /* DYNAMIC */ }, 1040, ["value", "border", "disabled"]); }), 128 /* KEYED_FRAGMENT */ )) ]) ]), _: 3 /* FORWARDED */ }, 16, ["size"]); }; } }); export { _sfc_main as default };