UNPKG

ai-form-designer

Version:

vue3+adv的设计器,可视化开发页面表单

68 lines (67 loc) 1.63 kB
import { defineComponent as m, ref as h, watch as u, computed as g, h as o, nextTick as v } from "vue"; import { ElUpload as E, ElButton as F, ElMessage as x } from "element-plus"; const y = m({ props: { modelValue: { type: Array, default: () => [] } }, emits: ["update:modelValue"], setup(n, { emit: r, attrs: d }) { const l = h([]); u(l, (e) => { r("update:modelValue", e); }), u( () => n.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 s = (e, a) => { v(() => { l.value = a; }); }, p = (e) => { }, i = (e, a, t) => { console.log(t); }, c = (e, a, t) => { x.error("上传失败"), console.error(e); }, f = g(() => ({ ...d, "file-list": l.value, onBeforeUpload: p, onChange: s, onSuccess: i, onError: c })); return () => o("div", null, { default: () => [ o(E, f.value, { default: () => [ o( F, {}, { default: () => [ o("span", { class: "icon--epic icon--epic--cloud-upload-outlined text-lg", style: { "margin-right": "2px" } }), o("span", null, { default: () => "上传文件" }) ] } ) ] }) ] }); } }); export { y as default };