kouxiangtang 0.0.1
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/README.md +7 -0
- package/dist/ImageUploader-Camc1yX9.js +97 -0
- package/dist/RichTextEditor-CZoZ3i-Q.js +1777 -0
- package/dist/index-B-_bBrFO.js +31380 -0
- package/dist/kouxiangtang.js +24 -0
- package/dist/kouxiangtang.umd.cjs +86 -0
- package/dist/style.css +6 -0
- package/dist/vite.svg +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Vue 3 + Vite
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
4
|
+
|
|
5
|
+
## Recommended IDE Setup
|
|
6
|
+
|
|
7
|
+
- [VS Code](https://code.visualstudio.com/) + [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously Volar) and disable Vetur
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { _ as y, b as E, l as I, p as v, d as x, E as p, e as m, a as B, f as M, h as b, i as C } from "./index-B-_bBrFO.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
|
+
const q = { class: "image-slot" }, z = {
|
|
4
|
+
__name: "ImageUploader",
|
|
5
|
+
props: {
|
|
6
|
+
imageUrl: { type: String }
|
|
7
|
+
},
|
|
8
|
+
emits: ["on-success"],
|
|
9
|
+
setup(f, { emit: _ }) {
|
|
10
|
+
const u = _, r = f, g = E().imageUploadUrl;
|
|
11
|
+
`${localStorage.getItem("token")}`;
|
|
12
|
+
const h = (e) => {
|
|
13
|
+
if (!(e.size / 1024 / 1024 < 5))
|
|
14
|
+
return p({
|
|
15
|
+
message: "上传大小不能超过 5MB!",
|
|
16
|
+
type: "warning"
|
|
17
|
+
}), !1;
|
|
18
|
+
}, U = (e) => {
|
|
19
|
+
u("on-success", e.data.imageUrl);
|
|
20
|
+
};
|
|
21
|
+
function k() {
|
|
22
|
+
console.log("删除"), u("on-success", "");
|
|
23
|
+
}
|
|
24
|
+
function w(e) {
|
|
25
|
+
return m.service({ text: "上传中,请稍后", background: "rgba(0,0,0,0.3)" }), new Promise((i, a) => {
|
|
26
|
+
const o = new FormData();
|
|
27
|
+
o.append("image", e.file), B.post(g, o, {}).then((d) => {
|
|
28
|
+
m.service().close(), p({
|
|
29
|
+
message: "上传成功",
|
|
30
|
+
type: "success"
|
|
31
|
+
}), i(d.data);
|
|
32
|
+
}).catch(() => {
|
|
33
|
+
m.service().close(), p({
|
|
34
|
+
message: "上传失败",
|
|
35
|
+
type: "warning"
|
|
36
|
+
}), a("Upload failed");
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return (e, i) => {
|
|
41
|
+
const a = M, o = b, d = C;
|
|
42
|
+
return t(), l(d, {
|
|
43
|
+
class: "image-uploader",
|
|
44
|
+
action: c(g),
|
|
45
|
+
name: "image",
|
|
46
|
+
"show-file-list": !1,
|
|
47
|
+
"on-success": U,
|
|
48
|
+
"before-upload": h,
|
|
49
|
+
"http-request": w
|
|
50
|
+
}, {
|
|
51
|
+
default: s(() => [
|
|
52
|
+
S(e.$slots, "default", {}, void 0, !0),
|
|
53
|
+
r.imageUrl ? (t(), l(o, {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "image",
|
|
56
|
+
src: r.imageUrl,
|
|
57
|
+
fit: "scale-down"
|
|
58
|
+
}, {
|
|
59
|
+
placeholder: s(() => [
|
|
60
|
+
L("div", q, [
|
|
61
|
+
n(a, { class: "placeholder-icon" }, {
|
|
62
|
+
default: s(() => [
|
|
63
|
+
n(c(I))
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
})
|
|
67
|
+
])
|
|
68
|
+
]),
|
|
69
|
+
_: 1
|
|
70
|
+
}, 8, ["src"])) : (t(), l(a, {
|
|
71
|
+
key: 1,
|
|
72
|
+
class: "uploader-icon"
|
|
73
|
+
}, {
|
|
74
|
+
default: s(() => [
|
|
75
|
+
n(c(v))
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
})),
|
|
79
|
+
r.imageUrl ? (t(), l(a, {
|
|
80
|
+
key: 2,
|
|
81
|
+
class: "delete-icon",
|
|
82
|
+
onClick: N(k, ["stop", "prevent"])
|
|
83
|
+
}, {
|
|
84
|
+
default: s(() => [
|
|
85
|
+
n(c(x))
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
})) : V("", !0)
|
|
89
|
+
]),
|
|
90
|
+
_: 3
|
|
91
|
+
}, 8, ["action"]);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}, A = /* @__PURE__ */ y(z, [["__scopeId", "data-v-19c702c5"]]);
|
|
95
|
+
export {
|
|
96
|
+
A as default
|
|
97
|
+
};
|