UNPKG

epic-designer-gold

Version:

基于vue3的设计器,可视化开发页面表单

71 lines (70 loc) 1.83 kB
import { defineComponent as m, ref as h, watch as u, h as o, nextTick as g } from "vue"; import { NUpload as x, NButton as V } from "naive-ui"; const F = m({ props: { modelValue: { type: Array, default: () => [] } }, emits: ["update:modelValue"], setup(n, { emit: r, attrs: d }) { const e = h([]); u(e, (l) => { r("update:modelValue", l); }), u( () => n.modelValue, (l) => { if (l != null && l.length > 0 && e.value != null) { if (e.value === l) return; e.value.length = 0, e.value.push(...l); } }, { deep: !0, immediate: !0 } ); function s(l) { console.log("onChange called->", l), g(() => { e.value = l; }); } const i = ({ file: l, event: a }) => { console.log("OnError called->", l, a); }, p = ({ file: l, event: a }) => { var t; console.log("OnFinish called->", l, a); const c = a == null ? void 0 : a.target, f = JSON.parse(c.response ?? "{}"); l.url = (t = f.data) == null ? void 0 : t.url; }; return () => o("div", null, { default: () => [ o(x, { ...d, "onUpdate:file-list": s, "file-list": e.value, onError: i, onFinish: p, "default-upload": !0 }, { default: () => [ o( V, {}, { default: () => [ o("span", { class: "icon--epic icon--epic--cloud-upload-outlined text-lg", style: { "margin-right": "2px" } }), o("span", null, { default: () => "上传文件" }) ] } ) ] }) ] }); } }); export { F as default };