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