@wfrog/vc
Version:
vue3 组件库 vc
54 lines (48 loc) • 1.89 kB
JavaScript
import './index.css'
import '../../chunk/E_WRn0OP.mjs';
import { E as ElRadioGroup, a as ElCheckboxGroup } from '../../chunk/cUoiVgQs.mjs';
import { defineComponent, computed, createBlock, openBlock, mergeProps, unref } from 'vue';
import { _ as _export_sfc } from '../../chunk/pcqpp-6-.mjs';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "choice",
props: {
multiple: { type: Boolean },
type: { default: "button" },
options: {}
},
setup(__props) {
const props = __props;
const myType = props.type;
const myOptions = computed(() => {
if (Array.isArray(props.options) && typeof props.options[0] === "string") {
return props.options.map((item) => ({ label: item, value: item }));
}
return props.options;
});
return (_ctx, _cache) => {
const _component_ElRadioGroup = ElRadioGroup;
const _component_ElCheckboxGroup = ElCheckboxGroup;
return !props.multiple ? (openBlock(), createBlock(_component_ElRadioGroup, mergeProps({ key: 0 }, _ctx.$attrs, {
type: unref(myType),
options: unref(myOptions)
}), null, 16, ["type", "options"])) : (openBlock(), createBlock(_component_ElCheckboxGroup, mergeProps({ key: 1 }, _ctx.$attrs, {
class: _ctx.$style.checkbox,
type: unref(myType),
options: unref(myOptions)
}), null, 16, ["class", "type", "options"]));
};
}
});
/* unplugin-vue-components disabled */const checkbox = "_checkbox_8th42_1";
const style0 = {
checkbox: checkbox
};
const cssModules = {
"$style": style0
};
const Component = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
const __vite_glob_0_5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
__proto__: null,
default: Component
}, Symbol.toStringTag, { value: 'Module' }));
export { Component as C, __vite_glob_0_5 as _ };