sci-pro
Version:
48 lines (47 loc) • 1.61 kB
JavaScript
import { defineComponent as d, computed as p, openBlock as n, createElementBlock as c, normalizeClass as u, normalizeStyle as m, createElementVNode as s, toDisplayString as b, createCommentVNode as h } from "vue";
import "./style/index.css";
const k = { class: "sci-checkbox__input" }, _ = ["checked", "disabled"], f = /* @__PURE__ */ s("span", { class: "sci-checkbox__inner" }, null, -1), y = {
key: 0,
class: "sci-chckbox-label"
}, g = d({ name: "sci-checkbox" }), v = /* @__PURE__ */ d({
...g,
props: {
modelValue: { type: Boolean, default: !1 },
lable: {},
disabled: { type: Boolean, default: !1 }
},
emits: ["update:modelValue", "change"],
setup(i, { emit: B }) {
const r = i, a = p(() => r.modelValue);
return (e, o) => (n(), c("label", {
class: u(["sci-checkbox", {
"is-checked": a.value
}]),
style: m({
cursor: e.disabled ? "not-allowed" : "pointer",
color: e.disabled ? "#A8ABB2" : "#000"
})
}, [
s("span", k, [
s("input", {
type: "checkbox",
checked: a.value,
disabled: e.disabled,
onChange: o[0] || (o[0] = (t) => {
var l;
return e.$emit("change", (l = t.target) == null ? void 0 : l.checked);
}),
onInput: o[1] || (o[1] = (t) => {
var l;
return e.$emit("update:modelValue", (l = t.target) == null ? void 0 : l.checked);
})
}, null, 40, _),
f
]),
e.lable ? (n(), c("span", y, b(e.lable), 1)) : h("", !0)
], 6));
}
});
export {
v as default
};