epic-designer-cjh
Version:
基于vue3的设计器,可视化开发页面表单
100 lines (99 loc) • 2.55 kB
JavaScript
import { defineComponent as E, ref as o, watch as u, computed as V, h as t, nextTick as y } from "vue";
import { n as U, t as w } from "./index-ef10270f.js";
import { E as C } from "./index-551fcfc8.js";
import "./index-97ce4605.js";
import "./isNil-8ef0e4b6.js";
import "./index-da336cb2.js";
import "./cloneDeep-aa0cb853.js";
import "./isEqual-eac09a18.js";
import "./_baseIsEqual-2f2ed312.js";
import "./use-global-config-0bac757e.js";
import "./debounce-30ba20d9.js";
const T = E({
props: {
modelValue: {
type: Array,
default: () => []
}
},
emits: ["update:modelValue"],
setup(p, { emit: d, attrs: m }) {
const l = o([]), r = o(""), i = o(!1), n = (e) => {
i.value = e;
};
u(l, (e) => {
d("update:modelValue", e);
}), u(
() => p.modelValue,
(e) => {
if (e != null && e.length > 0 && l.value != null) {
if (l.value === e)
return;
l.value.length = 0, l.value.push(...e);
}
},
{ deep: !0, immediate: !0 }
);
const c = (e, a) => {
y(() => {
l.value = a;
});
}, g = (e, a, s) => {
console.log(s);
}, f = (e, a, s) => {
w.error("上传失败"), console.error(e);
}, v = (e) => {
}, h = V(() => ({
...m,
"file-list": l.value,
"list-type": "picture-card",
accept: "image/gif,image/jpeg,image/jpg,image/png,image/svg",
onBeforeUpload: v,
onChange: c,
onSuccess: g,
onError: f,
onPreview: x
})), x = (e) => {
e.url && (r.value = e.url, n(!0));
};
return () => t(
"div",
{
class: "epic-upload-image"
},
{
default: () => [
t(U, h.value, {
default: () => [
t("div", { style: { "text-align": "center" } }, {
default: () => [
t("span", {
class: "iconfont epic-icon-shangchuan1 text-md",
style: { "margin-right": "2px" }
}),
t(
"div",
{ class: "ant-upload-text" },
{ default: () => "点击上传" }
)
]
})
]
}),
(() => {
if (i.value)
return t(C, {
urlList: [r.value],
onClose: () => {
n(!1);
}
});
})()
]
}
);
}
});
export {
T as default
};