import{A as V}from"./api.46176471.js";import{s as b}from"./index.ad3efb29.js";import{d as g,Z as f,r as v,B as x,ai as u,o as w,c as C,U as t,O as l,u as s,S as p}from"./vue.adf17aba.js";const A={style:{padding:"20px"}},N=g({__name:"addTabs",setup(B){let o=f({title:null,key:null});const i=v(),_=f({title:[{required:!0,message:"请输入"}],key:[{required:!0,message:"请输入"},{pattern:/^[A-Za-z0-9]+$/,message:"只能是英文和数字"}]}),c=x("refreshView"),y=async m=>{m&&await m.validate((e,r)=>{e?V(o).then(n=>{n.code==2e3&&(b("新增成功"),c())}):console.log("error submit!",r)})};return(m,e)=>{const r=u("el-input"),n=u("el-form-item"),d=u("el-button"),k=u("el-form");return w(),C("div",A,[t(k,{ref_key:"formRef",ref:i,model:s(o),rules:_,"label-width":"80px"},{default:l(()=>[t(n,{label:"标题",prop:"title"},{default:l(()=>[t(r,{modelValue:s(o).title,"onUpdate:modelValue":e[0]||(e[0]=a=>s(o).title=a)},null,8,["modelValue"])]),_:1}),t(n,{label:"key值",prop:"key"},{default:l(()=>[t(r,{modelValue:s(o).key,"onUpdate:modelValue":e[1]||(e[1]=a=>s(o).key=a)},null,8,["modelValue"])]),_:1}),t(n,null,{default:l(()=>[t(d,{type:"primary",onClick:e[2]||(e[2]=a=>y(i.value))},{default:l(()=>[p("立即创建")]),_:1}),t(d,null,{default:l(()=>[p("取消")]),_:1})]),_:1})]),_:1},8,["model","rules"])])}}});export{N as _};
