"use strict";(self["webpackChunkmi_wifi_agent"]=self["webpackChunkmi_wifi_agent"]||[]).push([[7218],{1411:function(e,l,r){r.r(l),r.d(l,{default:function(){return s}});var a=r(641);function u(e,l,r,u,t,o){const m=(0,a.g2)("el-input"),d=(0,a.g2)("el-form-item"),n=(0,a.g2)("el-button"),s=(0,a.g2)("el-form"),i=(0,a.g2)("el-card"),f=(0,a.g2)("el-alert"),p=(0,a.g2)("el-main");return(0,a.uX)(),(0,a.Wv)(p,null,{default:(0,a.k6)((()=>[(0,a.bF)(i,{shadow:"never",header:"async-validator内置"},{default:(0,a.k6)((()=>[(0,a.bF)(s,{ref:"form",model:t.form,rules:t.rules,"label-width":"100px","status-icon":""},{default:(0,a.k6)((()=>[(0,a.bF)(d,{label:"必填",prop:"required"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form.required,"onUpdate:modelValue":l[0]||(l[0]=e=>t.form.required=e)},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,{label:"长度",prop:"length"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form.length,"onUpdate:modelValue":l[1]||(l[1]=e=>t.form.length=e),placeholder:"长度需为3位"},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,{label:"类型",prop:"type"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form.type,"onUpdate:modelValue":l[2]||(l[2]=e=>t.form.type=e),placeholder:"类型可为string number boolean array date url email等"},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,{label:"范围",prop:"range"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form.range,"onUpdate:modelValue":l[3]||(l[3]=e=>t.form.range=e),placeholder:"请填写范围在3至5位"},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,{label:"枚举",prop:"enum"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form.enum,"onUpdate:modelValue":l[4]||(l[4]=e=>t.form.enum=e),placeholder:"请填写admin，user，guest其一"},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,{label:"自定义",prop:"custom"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form.custom,"onUpdate:modelValue":l[5]||(l[5]=e=>t.form.custom=e),placeholder:"请填写数字1"},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,{label:"异步验证",prop:"async"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form.async,"onUpdate:modelValue":l[6]||(l[6]=e=>t.form.async=e),placeholder:"请输入SCUI最新版本号,form开启status-icon后 可以查看右侧状态"},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,null,{default:(0,a.k6)((()=>[(0,a.bF)(n,{type:"primary",onClick:o.submit},{default:(0,a.k6)((()=>[(0,a.eW)("验证所有字段")])),_:1},8,["onClick"]),(0,a.bF)(n,{onClick:l[7]||(l[7]=e=>o.resetForm("form"))},{default:(0,a.k6)((()=>[(0,a.eW)("Reset")])),_:1})])),_:1})])),_:1},8,["model","rules"])])),_:1}),(0,a.bF)(i,{shadow:"never",header:"自定义",style:{"margin-top":"15px"}},{default:(0,a.k6)((()=>[(0,a.bF)(s,{ref:"form2",model:t.form2,rules:t.rules2,"label-width":"100px","status-icon":""},{default:(0,a.k6)((()=>[(0,a.bF)(d,{label:"手机号码",prop:"phone"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form2.phone,"onUpdate:modelValue":l[8]||(l[8]=e=>t.form2.phone=e)},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,{label:"车牌号码",prop:"cars"},{default:(0,a.k6)((()=>[(0,a.bF)(m,{modelValue:t.form2.cars,"onUpdate:modelValue":l[9]||(l[9]=e=>t.form2.cars=e)},null,8,["modelValue"])])),_:1}),(0,a.bF)(d,null,{default:(0,a.k6)((()=>[(0,a.bF)(n,{type:"primary",onClick:o.submit2},{default:(0,a.k6)((()=>[(0,a.eW)("验证所有字段")])),_:1},8,["onClick"]),(0,a.bF)(n,{onClick:l[10]||(l[10]=e=>o.resetForm("form2"))},{default:(0,a.k6)((()=>[(0,a.eW)("Reset")])),_:1})])),_:1})])),_:1},8,["model","rules"]),(0,a.bF)(f,{title:"自定义验证可在 @/utils/verificate.js 中不断扩展业务需要的验证. 记得要 import 进来",type:"success"})])),_:1})])),_:1})}function t(e,l,r){let a=/^[1][3, 4, 5, 6, 7, 8, 9][0-9]{9}$/;if(!a.test(l))return r(new Error("请输入正确的手机号码"));r()}function o(e,l,r){let a=/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/;if(!a.test(l))return r(new Error("请输入正确的车牌号码"));r()}var m={name:"verificate",data(){return{form:{},rules:{required:[{required:!0,message:"请填写"}],length:[{required:!0,len:3,message:"长度需为3位"}],type:[{required:!0,type:"email",message:"类型需为email"}],range:[{required:!0,min:3,max:5,message:"范围在3至5位"}],enum:[{required:!0,type:"enum",enum:["admin","user","guest"],message:"请填写admin，user，guest其一"}],custom:[{required:!0,validator:(e,l)=>"1"===l,message:"请填写数字1",trigger:"blur"}],async:[{required:!0,validator:(e,l,r)=>{this.$API.demo.ver.get({value:l}).then((e=>{if(e.data!=l)return r(new Error("请输入SCUI最新版本号："+e.data));r()}))},trigger:"blur"}]},form2:{},rules2:{phone:[{required:!0,message:"请输入姓名"},{validator:t,trigger:"blur"}],cars:[{required:!0,validator:o,trigger:"blur"}]}}},mounted(){},methods:{submit(){this.$refs.form.validate((async e=>{if(!e)return!1;this.$message.success("全部验证通过")}))},submit2(){this.$refs.form2.validate((async e=>{if(!e)return!1;this.$message.success("全部验证通过")}))},resetForm(e){this.$refs[e].resetFields()}}},d=r(6262);const n=(0,d.A)(m,[["render",u]]);var s=n}}]);