import{E as D}from"./chunks/index.39bf7ed4.js";import{f as m,B as r,o as E,c as h,x as p,D as e,z as n,b as F,a as l,N as b}from"./chunks/framework.68f3e7ab.js";const v=p("h1",{id:"弹出框表单",tabindex:"-1"},[l("弹出框表单 "),p("a",{class:"header-anchor",href:"#弹出框表单","aria-label":'Permalink to "弹出框表单"'},"​")],-1),f=p("h2",{id:"效果",tabindex:"-1"},[l("效果 "),p("a",{class:"header-anchor",href:"#效果","aria-label":'Permalink to "效果"'},"​")],-1),_={style:{padding:"1em",border:"1px solid #ccc","border-radius":"10px","margin-top":"20px"}},x=p("div",{style:{color:"#ccc","font-size":"12px"}}," jpg/png files with a size less than 500KB. ",-1),k=b("",2),N=JSON.parse('{"title":"弹出框表单","description":"","frontmatter":{},"headers":[],"relativePath":"examples/ModalForm/index.md"}'),B={name:"examples/ModalForm/index.md"},M=Object.assign(B,{setup(S){const o=m(!1),y=()=>{o.value=!o.value},C=[{type:"input",value:"",label:"用户名",prop:"username",rules:[{required:!0,message:"用户名不能为空",trigger:"change"},{min:2,max:10,message:"用户名在2-10位之间",trigger:"change"}],attrs:{clearable:!0}},{type:"input",value:"",label:"密码",prop:"password",rules:[{required:!0,message:"密码不能为空",trigger:"change"},{min:6,max:15,message:"密码在6-15位之间",trigger:"change"}],attrs:{clearable:!0}},{type:"select",value:"",placeholder:"请选择职位",prop:"role",label:"职位",rules:[{required:!0,message:"职位不能为空",trigger:"change"}],children:[{type:"option",label:"经理",value:"1"},{type:"option",label:"董事",value:"2"},{type:"option",label:"高管",value:"3"}],attrs:{style:{width:"100%"}}},{type:"checkbox-group",value:[],label:"爱好",prop:"like",rules:[{required:!0,message:"爱好不能为空",trigger:"change"}],children:[{type:"checkbox",label:"足球",value:"1"},{type:"checkbox",label:"篮球",value:"2"},{type:"checkbox",label:"排球",value:"3"}]},{type:"radio-group",value:[],label:"性别",prop:"gender",rules:[{required:!0,message:"性别不能为空",trigger:"change"}],children:[{type:"radio",label:"男",value:"1"},{type:"radio",label:"女",value:"2"},{type:"radio",label:"保密",value:"3"}]},{type:"upload",label:"上传",prop:"picture",rules:[{required:!0,message:"文件不能为空",trigger:"change"}],UploadAttrs:{action:"https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15",multiple:!0,limit:3}},{type:"editor",value:"11111111",prop:"desc",label:"描述",placeholder:"请输入内容",rules:[{required:!0,message:"描述不能为空",trigger:"change"}]}],A=s=>{o.value=!1},i=s=>{let t=s.validate();s.getFormData(),t(a=>{a?D.success("验证成功"):D.error("验证失败")})};let u=s=>{console.log("success"),console.log(s)},q=s=>{console.log("change"),console.log(s)};return(s,t)=>{const a=r("el-button"),g=r("xs-modalForm");return E(),h("div",null,[v,f,p("div",_,[e(a,{type:"primary",onClick:y},{default:n(()=>[l("open")]),_:1}),e(g,{isScroll:"",visible:o.value,"onUpdate:visible":t[0]||(t[0]=c=>o.value=c),title:"编辑",width:"50%",options:C,"on-change":F(q),"on-success":F(u)},{footer:n(c=>[e(a,{onClick:d=>A(c.form)},{default:n(()=>[l("取消")]),_:2},1032,["onClick"]),e(a,{type:"primary",onClick:d=>i(c.form)},{default:n(()=>[l("确认")]),_:2},1032,["onClick"])]),uploadArea:n(()=>[e(a,{type:"primary"},{default:n(()=>[l("Click to upload")]),_:1})]),uploadTip:n(()=>[x]),_:1},8,["visible","on-change","on-success"])]),k])}}});export{N as __pageData,M as default};
