kouxiangtang 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ImageUploader-BDU31gwP.js +98 -0
- package/dist/{RichTextEditor-BMsUo6Ib.js → RichTextEditor-QELxq5UR.js} +1 -1
- package/dist/index-DthJSd0-.js +32810 -0
- package/dist/kouxiangtang.js +8 -8
- package/dist/kouxiangtang.umd.cjs +76 -9
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/ImageUploader-CIMFMJHg.js +0 -98
- package/dist/index-z9s-vTIc.js +0 -6311
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { _ as y, b as E, l as I, p as v, d as x, a as B, E as M, e as b, f as C } from "./index-DthJSd0-.js";
|
|
2
|
+
import { openBlock as t, createBlock as l, unref as c, withCtx as s, renderSlot as S, createElementVNode as L, createVNode as n, withModifiers as N, createCommentVNode as V } from "vue";
|
|
3
|
+
import { ElMessage as m, ElLoading as p } from "element-plus";
|
|
4
|
+
const q = { class: "image-slot" }, z = {
|
|
5
|
+
__name: "ImageUploader",
|
|
6
|
+
props: {
|
|
7
|
+
imageUrl: { type: String }
|
|
8
|
+
},
|
|
9
|
+
emits: ["on-success"],
|
|
10
|
+
setup(f, { emit: _ }) {
|
|
11
|
+
const u = _, r = f, g = E().imageUploadUrl;
|
|
12
|
+
`${localStorage.getItem("token")}`;
|
|
13
|
+
const U = (e) => {
|
|
14
|
+
if (!(e.size / 1024 / 1024 < 5))
|
|
15
|
+
return m({
|
|
16
|
+
message: "上传大小不能超过 5MB!",
|
|
17
|
+
type: "warning"
|
|
18
|
+
}), !1;
|
|
19
|
+
}, h = (e) => {
|
|
20
|
+
u("on-success", e.data.imageUrl);
|
|
21
|
+
};
|
|
22
|
+
function k() {
|
|
23
|
+
console.log("删除"), u("on-success", "");
|
|
24
|
+
}
|
|
25
|
+
function w(e) {
|
|
26
|
+
return p.service({ text: "上传中,请稍后", background: "rgba(0,0,0,0.3)" }), new Promise((i, a) => {
|
|
27
|
+
const o = new FormData();
|
|
28
|
+
o.append("image", e.file), B.post(g, o, {}).then((d) => {
|
|
29
|
+
p.service().close(), m({
|
|
30
|
+
message: "上传成功",
|
|
31
|
+
type: "success"
|
|
32
|
+
}), i(d.data);
|
|
33
|
+
}).catch(() => {
|
|
34
|
+
p.service().close(), m({
|
|
35
|
+
message: "上传失败",
|
|
36
|
+
type: "warning"
|
|
37
|
+
}), a("Upload failed");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return (e, i) => {
|
|
42
|
+
const a = M, o = b, d = C;
|
|
43
|
+
return t(), l(d, {
|
|
44
|
+
class: "image-uploader",
|
|
45
|
+
action: c(g),
|
|
46
|
+
name: "image",
|
|
47
|
+
"show-file-list": !1,
|
|
48
|
+
"on-success": h,
|
|
49
|
+
"before-upload": U,
|
|
50
|
+
"http-request": w
|
|
51
|
+
}, {
|
|
52
|
+
default: s(() => [
|
|
53
|
+
S(e.$slots, "default", {}, void 0, !0),
|
|
54
|
+
r.imageUrl ? (t(), l(o, {
|
|
55
|
+
key: 0,
|
|
56
|
+
class: "image",
|
|
57
|
+
src: r.imageUrl,
|
|
58
|
+
fit: "scale-down"
|
|
59
|
+
}, {
|
|
60
|
+
placeholder: s(() => [
|
|
61
|
+
L("div", q, [
|
|
62
|
+
n(a, { class: "placeholder-icon" }, {
|
|
63
|
+
default: s(() => [
|
|
64
|
+
n(c(I))
|
|
65
|
+
]),
|
|
66
|
+
_: 1
|
|
67
|
+
})
|
|
68
|
+
])
|
|
69
|
+
]),
|
|
70
|
+
_: 1
|
|
71
|
+
}, 8, ["src"])) : (t(), l(a, {
|
|
72
|
+
key: 1,
|
|
73
|
+
class: "uploader-icon"
|
|
74
|
+
}, {
|
|
75
|
+
default: s(() => [
|
|
76
|
+
n(c(v))
|
|
77
|
+
]),
|
|
78
|
+
_: 1
|
|
79
|
+
})),
|
|
80
|
+
r.imageUrl ? (t(), l(a, {
|
|
81
|
+
key: 2,
|
|
82
|
+
class: "delete-icon",
|
|
83
|
+
onClick: N(k, ["stop", "prevent"])
|
|
84
|
+
}, {
|
|
85
|
+
default: s(() => [
|
|
86
|
+
n(c(x))
|
|
87
|
+
]),
|
|
88
|
+
_: 1
|
|
89
|
+
})) : V("", !0)
|
|
90
|
+
]),
|
|
91
|
+
_: 3
|
|
92
|
+
}, 8, ["action"]);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}, F = /* @__PURE__ */ y(z, [["__scopeId", "data-v-19c702c5"]]);
|
|
96
|
+
export {
|
|
97
|
+
F as default
|
|
98
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as tn, onMounted as rn, onBeforeUnmount as nn, ref as $r, watch as Ir, nextTick as Gr, h as an, openBlock as on, createBlock as sn, unref as un } from "vue";
|
|
2
2
|
import * as Dr from "quill";
|
|
3
3
|
import Pr from "quill";
|
|
4
|
-
import { c as W, g as ln, a as fn, b as cn } from "./index-
|
|
4
|
+
import { c as W, g as ln, a as fn, b as cn } from "./index-DthJSd0-.js";
|
|
5
5
|
import hn from "quill-image-uploader";
|
|
6
6
|
var ue = -1, ne = 1, Z = 0;
|
|
7
7
|
function it(r, a, n, u) {
|