vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
49 lines (48 loc) • 1.82 kB
JavaScript
import { defineComponent as u, createElementBlock as n, openBlock as l, normalizeStyle as c, unref as t, normalizeClass as k, createElementVNode as s, createCommentVNode as w, withModifiers as g, createStaticVNode as f } from "vue";
import { useSwitch as y } from "./hook/useSwitch.mjs";
const B = {
key: 0,
xmlns: "http://www.w3.org/2000/svg",
class: "is-loading",
width: "14",
height: "14",
viewBox: "0 0 24 24",
stroke: "currentColor",
"stroke-width": "2",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, N = /* @__PURE__ */ u({
name: "Switch",
__name: "index",
props: {
modelValue: { type: [Boolean, String, Number] },
loading: { type: Boolean },
disabled: { type: Boolean },
checkedValue: { type: [Boolean, String, Number], default: !0 },
uncheckedValue: { type: [Boolean, String, Number] },
theme: { default: "var(--app-theme)" }
},
emits: ["update:modelValue", "change"],
setup(i, { emit: p }) {
const o = i, r = p, { classNames: d, isLoading: m, handleClick: a } = y(o, r);
return (b, e) => (l(), n("label", {
class: k(t(d)),
onClick: e[1] || (e[1] = //@ts-ignore
(...h) => t(a) && t(a)(...h)),
style: c("--switch-theme:" + o.theme)
}, [
s("input", {
type: "checkbox",
onClick: e[0] || (e[0] = g(() => {
}, ["stop"]))
}),
e[3] || (e[3] = s("div", { class: "switch-knobs" }, null, -1)),
t(m) ? (l(), n("svg", B, [...e[2] || (e[2] = [
f('<path d="M12 2v4"></path><path d="m16.2 7.8 2.9-2.9"></path><path d="M18 12h4"></path><path d="m16.2 16.2 2.9 2.9"></path><path d="M12 18v4"></path><path d="m4.9 19.1 2.9-2.9"></path><path d="M2 12h4"></path><path d="m4.9 4.9 2.9 2.9"></path>', 8)
])])) : w("", !0)
], 6));
}
});
export {
N as default
};