UNPKG

dk-plus

Version:
41 lines (40 loc) 977 B
import { defineComponent as i, ref as c, reactive as s, watch as u, nextTick as r, toRefs as f } from "vue"; import { dkRadioProps as h } from "./index3.js"; import "../../_icon/index.js"; import { getRadio as b } from "../../_hooks/get-radio/index.js"; const V = i({ name: "DkRadio", props: h, emits: ["update:modelValue", "change"], setup(e, { emit: d }) { const l = c(), a = s({ name: e.name, check: e.modelValue, disabled: e.disabled, label: e.label }), { classList: o, styleList: m } = b(e), n = { handleChange: () => { let t = a.name || a.label; d("update:modelValue", t), d("change", t); } }; return u( () => e.modelValue, async (t) => { await r(), l.value && (l.value.checked = t === a.name); }, { immediate: !0 } ), { radio: l, ...f(a), ...n, classList: o, styleList: m }; } }); export { V as default };