tyh-ui2
Version:
The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.
43 lines (42 loc) • 1.22 kB
JavaScript
import { defineComponent as c, inject as o, computed as r, getCurrentInstance as y, openBlock as s, createElementBlock as i, normalizeClass as k, unref as l, normalizeStyle as C, renderSlot as _, toDisplayString as S } from "vue";
import { Props as $ } from "./index2.js";
const b = { key: 1 }, g = c({
name: "TyhMenuItem"
}), B = /* @__PURE__ */ c({
...g,
props: $,
setup(m) {
const t = m, u = o("theme"), p = o("mode"), n = o("textColor"), a = r(() => [
{
color: n || (u === "dark" ? "#fff" : "#333")
}
]), { proxy: f } = y(), h = () => {
if (!t.prohibit) {
if (t.link) {
window.open(t.link, "link");
return;
}
if (t.route)
try {
f.$router.push(t.route);
} catch (e) {
console.log(e);
}
}
}, d = r(() => [
"tyh-menu-item",
`tyh-menu-item-hover-${p}`,
{ "tyh-menu-item-prohibit": t.prohibit }
]);
return (e, w) => (s(), i("li", {
class: k(l(d)),
style: C(l(a)),
onClick: h
}, [
e.$slots.default ? _(e.$slots, "default", { key: 0 }) : (s(), i("span", b, S(e.title), 1))
], 6));
}
});
export {
B as default
};