@wetspace/pro-components
Version:
::: tip 基本介绍
112 lines (111 loc) • 3.46 kB
JavaScript
import { defineComponent as M, resolveComponent as S, openBlock as o, createBlock as t, unref as s, withCtx as l, resolveDynamicComponent as z, createCommentVNode as u, createElementVNode as m, toDisplayString as r, createElementBlock as B, Fragment as b, renderList as N } from "vue";
import { ElMenuItem as g, ElIcon as f, ElSubMenu as v } from "element-plus";
const D = { class: "menu-item__collapse" }, V = { class: "menu-item__collapse" }, F = /* @__PURE__ */ M({
name: "MenuItem",
__name: "menu-item",
props: {
info: {
type: Object,
default() {
return {
path: "",
name: ""
};
}
},
isCollapse: Boolean,
iconSize: Number
},
emits: ["menuClick"],
setup(x, { emit: h }) {
const I = h, e = x, p = (_) => {
e.info && e.info.onClick && e.info.onClick(), I("menuClick", _);
};
return (_, d) => {
var k, C, y;
const E = S("MenuItem", !0);
return (k = e.info) != null && k.routes ? (o(), t(s(v), {
key: 1,
index: (y = e.info) == null ? void 0 : y.path
}, {
title: l(() => {
var i, a, c;
return [
(i = e.info) != null && i.icon ? (o(), t(s(f), {
key: 0,
size: e.iconSize
}, {
default: l(() => {
var n;
return [
(o(), t(z((n = e.info) == null ? void 0 : n.icon)))
];
}),
_: 1
}, 8, ["size"])) : u("", !0),
!((a = e.info) != null && a.icon) && e.isCollapse ? (o(), t(s(f), {
key: 1,
size: 16
}, {
default: l(() => {
var n;
return [
m("span", V, r((n = e.info) == null ? void 0 : n.name[0]), 1)
];
}),
_: 1
})) : u("", !0),
m("span", null, r((c = e.info) == null ? void 0 : c.name), 1)
];
}),
default: l(() => [
(o(!0), B(b, null, N(e.info.routes, (i) => (o(), t(E, {
key: i.path,
info: i,
onClick: () => p(i)
}, null, 8, ["info", "onClick"]))), 128))
]),
_: 1
}, 8, ["index"])) : (o(), t(s(g), {
key: 0,
index: (C = e.info) == null ? void 0 : C.path,
onClick: d[0] || (d[0] = () => p(e.info))
}, {
default: l(() => {
var i, a, c;
return [
(i = e.info) != null && i.icon ? (o(), t(s(f), {
key: 0,
size: e.iconSize
}, {
default: l(() => {
var n;
return [
(o(), t(z((n = e.info) == null ? void 0 : n.icon)))
];
}),
_: 1
}, 8, ["size"])) : u("", !0),
!((a = e.info) != null && a.icon) && e.isCollapse ? (o(), t(s(f), {
key: 1,
size: 16
}, {
default: l(() => {
var n;
return [
m("span", D, r((n = e.info) == null ? void 0 : n.name[0]), 1)
];
}),
_: 1
})) : u("", !0),
m("span", null, r((c = e.info) == null ? void 0 : c.name), 1)
];
}),
_: 1
}, 8, ["index"]));
};
}
});
export {
F as default
};