40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import { w as withInstall } from "../badge/index2.js";
|
|
import { defineComponent, ref, provide, watch, openBlock, createElementBlock, renderSlot } from "vue";
|
|
const _hoisted_1 = { class: "layui-radio-group" };
|
|
const __default__ = {
|
|
name: "LayRadioGroup"
|
|
};
|
|
const _sfc_main = defineComponent({
|
|
...__default__,
|
|
props: {
|
|
modelValue: { type: [String, Boolean, Number] },
|
|
name: null,
|
|
disabled: { type: Boolean, default: false }
|
|
},
|
|
emits: ["update:modelValue", "change"],
|
|
setup(__props, { emit }) {
|
|
const props = __props;
|
|
const modelValue = ref(props.modelValue);
|
|
const disabled = ref(props.disabled);
|
|
provide("radioGroup", {
|
|
name: "LayRadioGroup",
|
|
modelValue,
|
|
naiveName: props.name,
|
|
disabled
|
|
});
|
|
watch(() => modelValue, (val) => {
|
|
emit("change", modelValue.value);
|
|
emit("update:modelValue", modelValue.value);
|
|
}, { deep: true });
|
|
watch(() => props.modelValue, (val) => modelValue.value = val);
|
|
watch(() => props.disabled, (val) => disabled.value = val);
|
|
return (_ctx, _cache) => {
|
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
renderSlot(_ctx.$slots, "default")
|
|
]);
|
|
};
|
|
}
|
|
});
|
|
const component = withInstall(_sfc_main);
|
|
export { component as default };
|