yk-element-components
Version:
118 lines (117 loc) • 3.98 kB
JavaScript
import { defineComponent as $, resolveComponent as a, openBlock as t, createElementBlock as o, createVNode as v, withCtx as u, Fragment as k, renderList as y, createBlock as m, unref as h, createCommentVNode as s, createElementVNode as x, toDisplayString as r, createTextVNode as z, normalizeClass as B, resolveDynamicComponent as w } from "vue";
const D = (c) => c.replace(/(A-Z)g/, "-$1").toLocaleLowerCase(), E = { class: "list-tabs__item" }, T = ["onClick"], q = {
key: 0,
class: "avatar"
}, F = { class: "content" }, O = {
key: 0,
class: "title"
}, S = {
key: 1,
class: "time"
}, Z = {
key: 2,
class: "time"
}, j = { class: "actions" }, G = ["onClick"], H = {
key: 0,
class: "a-icon"
}, J = {
key: 1,
class: "a-text"
}, K = /* @__PURE__ */ $({
__name: "index",
props: {
list: {
type: Array,
required: !0
},
actions: {
type: Array,
default: () => []
}
},
emits: ["clickItem", "clickAction"],
setup(c, { emit: i }) {
let _ = (l, d) => {
i("clickItem", { item: l, index: d });
}, p = (l, d) => {
i("clickAction", { item: l, index: d });
};
return (l, d) => {
const g = a("el-avatar"), C = a("el-tag"), b = a("el-scrollbar"), A = a("el-tab-pane"), L = a("el-tabs");
return t(), o("div", E, [
v(L, null, {
default: u(() => [
(t(!0), o(k, null, y(c.list, (f, N) => (t(), m(A, {
key: N,
label: f.title
}, {
default: u(() => [
v(b, { "max-height": "300px" }, {
default: u(() => [
(t(!0), o(k, null, y(f.content, (e, n) => (t(), o("div", {
class: "container",
onClick: (V) => h(_)(e, n),
key: n
}, [
e.avatar ? (t(), o("div", q, [
v(g, {
size: "small",
src: e.avatar
}, null, 8, ["src"])
])) : s("", !0),
x("div", F, [
e.title ? (t(), o("div", O, [
x("div", null, r(e.title), 1),
e.tag ? (t(), m(C, {
key: 0,
size: "small",
type: e.tagType
}, {
default: u(() => [
z(r(e.tag), 1)
]),
_: 2
}, 1032, ["type"])) : s("", !0)
])) : s("", !0),
e.desc ? (t(), o("div", S, r(e.desc), 1)) : s("", !0),
e.time ? (t(), o("div", Z, r(e.time), 1)) : s("", !0)
])
], 8, T))), 128)),
x("div", j, [
(t(!0), o(k, null, y(c.actions, (e, n) => (t(), o("div", {
class: B(["a-item", { border: n !== c.actions.length }]),
key: n,
onClick: (V) => h(p)(e, n)
}, [
e.icon ? (t(), o("div", H, [
(t(), m(w(`el-icon-${h(D)(e.icon)}`)))
])) : s("", !0),
e.text ? (t(), o("div", J, r(e.text), 1)) : s("", !0)
], 10, G))), 128))
])
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["label"]))), 128))
]),
_: 1
})
]);
};
}
});
const M = (c, i) => {
const _ = c.__vccOpts || c;
for (const [p, l] of i)
_[p] = l;
return _;
}, P = /* @__PURE__ */ M(K, [["__scopeId", "data-v-27a83e27"]]), R = {
install(c) {
c.component("yk-list", P);
}
};
export {
R as default
};