UNPKG

ai-form-designer

Version:

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

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