@artmate/chat
Version:
**开箱即用的AI组件库(基于 Vue3 + ElementPlus)**
60 lines (59 loc) • 1.74 kB
JavaScript
import { defineComponent as u, createBlock as i, openBlock as n, unref as o, normalizeProps as f, guardReactiveProps as y, withCtx as r, createElementVNode as s, normalizeClass as a, renderSlot as C, createVNode as _, createElementBlock as h, Fragment as w, renderList as E, mergeProps as g, createTextVNode as v, toDisplayString as D } from "vue";
import { ElDropdown as N, ElDropdownMenu as P, ElDropdownItem as b } from "element-plus";
import { useNamespace as B } from "../hooks/useNamespace.js";
const S = /* @__PURE__ */ u({
__name: "ActionMenu",
props: {
item: {}
},
emits: ["click"],
setup(c, { emit: m }) {
const d = c, p = m, l = B("actions");
function k(e) {
if (e.onItemClick) {
e.onItemClick(e);
return;
}
p("click", {
key: e.key,
keyPath: [d.item.key, e.key],
item: e
});
}
return (e, I) => (n(), i(o(N), f(y(e.$attrs)), {
dropdown: r(() => [
_(o(P), null, {
default: r(() => [
(n(!0), h(w, null, E(e.item.children, (t) => (n(), i(o(b), g({
key: t.key,
ref_for: !0
}, t, {
onClick: (V) => k(t)
}), {
default: r(() => [
v(D(t.label), 1)
]),
_: 2
}, 1040, ["onClick"]))), 128))
]),
_: 1
})
]),
default: r(() => [
s("div", {
class: a(o(l).b("list-item"))
}, [
s("div", {
class: a(o(l).b("list-item-icon"))
}, [
C(e.$slots, "icon", { info: e.item })
], 2)
], 2)
]),
_: 3
}, 16));
}
});
export {
S as default
};