@artmate/chat
Version:
**开箱即用的AI组件库(基于 Vue3 + ElementPlus)**
73 lines (72 loc) • 2.15 kB
JavaScript
import { defineComponent as v, ref as d, createElementBlock as i, openBlock as c, normalizeStyle as h, normalizeClass as s, unref as a, createVNode as y, mergeProps as D, withCtx as k, createElementVNode as r, renderSlot as t, Fragment as N } from "vue";
import { ElUpload as $ } from "element-plus";
import { useNamespace as E } from "../hooks/useNamespace.js";
const w = ["aria-hidden"], R = /* @__PURE__ */ v({
__name: "PlaceholderUploader",
props: {
disabled: { type: Boolean, default: !1 },
className: {},
style: {},
upload: {}
},
setup(p, { expose: f }) {
const u = p, l = E("attachment-placeholder"), o = d(!1), n = d();
function m() {
o.value = !0;
}
function b(e) {
e.currentTarget.contains(e.relatedTarget) || (o.value = !1);
}
function g() {
o.value = !1;
}
return f({
uploadRef: n
}), (e, B) => (c(), i("div", {
"aria-hidden": e.disabled,
class: s([a(l).b(), { [a(l).b("drag-in")]: o.value, [a(l).b("disabled")]: e.disabled }, e.className]),
style: h(e.style),
onDrag: g,
onDragenter: m,
onDragleave: b
}, [
y(a($), D(u.upload, {
ref_key: "uploadRef",
ref: n,
"auto-upload": !1,
class: [a(l).b("upload-wrapper")],
"show-file-list": !1,
action: "#",
drag: ""
}), {
default: k(() => [
r("div", {
class: s([a(l).b("inner")])
}, [
e.$slots.default ? t(e.$slots, "default", { key: 0 }) : (c(), i(N, { key: 1 }, [
r("div", {
class: s([a(l).b("icon")])
}, [
t(e.$slots, "icon")
], 2),
r("div", {
class: s([a(l).b("title")])
}, [
t(e.$slots, "title")
], 2),
r("div", {
class: s([a(l).b("description")])
}, [
t(e.$slots, "description")
], 2)
], 64))
], 2)
]),
_: 3
}, 16, ["class"])
], 46, w));
}
});
export {
R as default
};