snowy-designer
Version:
基于Epic-Designer-Pro版本的设计器,可视化开发页面表单
100 lines (99 loc) • 2.67 kB
JavaScript
import { defineComponent as h, ref as g, watch as u, h as r, nextTick as U } from "vue";
/* empty css */
import "radix-vue";
import "clsx";
import "tailwind-merge";
import "lucide-vue-next";
import "../../../ui-kit/base-ui/src/shadch-ui/button/index.js";
import "@vueuse/core";
import "../../../ui-kit/base-ui/src/shadch-ui/toast/index.js";
import "vuedraggable";
import { getFileNameByUrl as x, getUUID as N } from "../../../utils/src/common/string.js";
import "../../../hooks/src/store/index.js";
import "lodash";
import "../../../utils/src/manager/pluginManager.js";
import "monaco-editor";
import "../../../utils/src/request/index.js";
import { NUpload as S, NButton as v } from "naive-ui";
const A = h({
emits: ["update:modelValue", "change"],
props: {
modelValue: {
default: "",
type: String
}
},
setup(n, { attrs: s, emit: a }) {
const i = g([]);
let l = "";
u(
() => i.value,
(t) => {
l = t.filter((e) => e.status === "finished").map((e) => e.url).join(","), a("update:modelValue", l), a("change", l);
}
), u(
() => n.modelValue,
(t) => {
if (l !== t) {
if (t === "") {
i.value = [];
return;
}
t !== null && i.value !== null && (i.value = t.split(",").map((e) => ({
id: N(),
name: x(e),
status: "finished",
url: e
})));
}
},
{ immediate: !0 }
);
function m(t) {
U(() => {
i.value = t;
});
}
const d = () => {
}, f = ({ event: t, file: e }) => {
var p;
const o = t == null ? void 0 : t.target, c = JSON.parse((o == null ? void 0 : o.response) ?? "{}");
e.url = (p = c.data) == null ? void 0 : p.url;
};
return () => r("div", null, {
default: () => [
r(
S,
{
...s,
"default-upload": !0,
onError: d,
onFinish: f,
"file-list": i.value,
"onUpdate:file-list": m
},
{
default: () => [
r(
v,
{},
{
default: () => [
r("span", {
class: "icon--epic icon--epic--cloud-upload-outlined text-lg",
style: { "margin-right": "2px" }
}),
r("span", null, { default: () => "上传文件" })
]
}
)
]
}
)
]
});
}
});
export {
A as default
};