tyh-ui2
Version:
The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.
47 lines (46 loc) • 1.4 kB
JavaScript
import { defineComponent as u, computed as s, openBlock as l, createElementBlock as r, normalizeClass as a, unref as o, normalizeStyle as i, createCommentVNode as p, renderSlot as y } from "vue";
import { Props as f } from "./index2.js";
const b = ["disabled"], m = u({
name: "TyhButton"
}), z = /* @__PURE__ */ u({
...m,
props: f,
setup(d) {
const t = d, n = s(() => {
const e = {
primary: "#3a6ff4",
success: "#54c600",
danger: "#d10f1b",
warning: "#fbcc30",
default: "#3f536e"
};
return t.simple ? e[t.type] : t.type === "default" || !t.type ? "#333" : "#fff";
}), c = s(() => [
"tyh-button",
`tyh-button-${t.type}`,
{
[`tyh-button-${t.size}`]: t.size,
"tyh-button-round": t.round,
"tyh-button-square": t.square,
"tyh-button-simple": t.simple,
"tyh-button-disabled": t.disabled || t.loading,
"tyh-button-block": t.block
}
]);
return (e, h) => (l(), r("button", {
class: a(o(c)),
disabled: e.disabled || e.loading,
style: i({ color: o(n) })
}, [
e.loading || e.icon ? (l(), r("i", {
key: 0,
class: a(["tyh-icon", e.loading ? "tyh-ui-loading" : e.icon]),
style: i({ color: o(n) })
}, null, 6)) : p("", !0),
y(e.$slots, "default")
], 14, b));
}
});
export {
z as default
};