sci-pro
Version:
59 lines (58 loc) • 2.05 kB
JavaScript
import { defineComponent as _, computed as k, openBlock as l, createElementBlock as o, normalizeClass as s, Fragment as r, renderList as u, createElementVNode as n, toDisplayString as p } from "vue";
import "./style/index.css";
const v = ["value", "checked", "onChange"], y = { class: "sci-radio__label" }, g = { class: "sci-radio__input" }, C = ["value", "checked", "onChange"], f = /* @__PURE__ */ n("span", { class: "sci-radio__inner" }, null, -1), V = { class: "sci-radio__label" }, z = _({ name: "sci-radio" }), E = /* @__PURE__ */ _({
...z,
props: {
modelValue: {},
radioInfo: {},
type: {},
size: {}
},
emits: ["update:modelValue", "onRadioChange"],
setup(h, { emit: b }) {
const d = h, i = b, c = k(() => ({ [`sci-radio--${d.size}`]: d.size })), t = (a) => {
i("update:modelValue", a.label), i("onRadioChange");
};
return (a, I) => a.type === "button" ? (l(), o("div", {
key: 0,
class: s(["sci-radio-button", c.value])
}, [
(l(!0), o(r, null, u(a.radioInfo, (e) => (l(), o("label", {
class: s(["sci-label", { "is-checked": e.label === a.modelValue }]),
key: e.label
}, [
n("input", {
name: "radio",
type: "radio",
value: e.label,
checked: e.label === a.modelValue,
onChange: (m) => t(e)
}, null, 40, v),
n("span", y, p(e.label), 1)
], 2))), 128))
], 2)) : (l(), o("div", {
key: 1,
class: s(["sci-radio", c.value])
}, [
(l(!0), o(r, null, u(a.radioInfo, (e) => (l(), o("label", {
class: s(["sci-label", { "is-checked": e.label === a.modelValue }]),
key: e.label
}, [
n("span", g, [
n("input", {
name: "radio",
type: "radio",
value: e.label,
checked: e.label === a.modelValue,
onChange: (m) => t(e)
}, null, 40, C),
f
]),
n("span", V, p(e.label), 1)
], 2))), 128))
], 2));
}
});
export {
E as default
};