402 lines
129 KiB
JavaScript
402 lines
129 KiB
JavaScript
|
import{J as V,b as $,r as m,o as A,h as B,e as t,d as o,z as s,f as n,g as a,a0 as y}from"./vendor.e7911ee1.js";const P={class:"markdown-body"},T=n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form")]),a(),n("span",{class:"token attr-name"},":model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u8D26\u6237"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model.username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u5BC6\u7801"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("password"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model.password"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"type"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("password"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7231\u597D"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("hobby"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model.hobby"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select-option")]),a(),n("span",{class:"token attr-name"},"value"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("1"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u5B66\u4E60"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select-option")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select-option")]),a(),n("span",{class:"token attr-name"},"value"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("2"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7F16\u7801"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select-option")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select-option")]),a(),n("span",{class:"token attr-name"},"value"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("3"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u8FD0\u52A8"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select-option")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7279\u957F"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-radio")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model.specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"name"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("1"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u5199\u4F5C"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-radio")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-radio")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model.specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"name"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("2"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u753B\u753B"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-radio")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-radio")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model.specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"name"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("3"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u7F16\u7801"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-radio")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u63CF\u8FF0"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("desc"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-textarea")]),a(),n("span",{class:"token attr-name"},"placeholder"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u8BF7\u8F93\u5165\u63CF\u8FF0"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("model.desc"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-textarea")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-button")]),a(),n("span",{class:"token attr-name"},"@click"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("submitClick"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u63D0\u4EA4"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-button")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("script")]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token script"},[n("span",{class:"token language-javascript"},[a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a(" ref"),n("span",{class:"token punctuation"},","),a(" reactive "),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'vue'"),a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a("layer"),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'@layui/layer-vue'"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"export"),a(),n("span",{class:"token keyword"},"default"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"setup"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" model "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"reactive"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
username`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'"admin"'),n("span",{class:"token punctuation"},","),a(`
|
||
|
password`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'"123456"'),n("span",{class:"token punctuation"},","),a(`
|
||
|
specialty`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'"1"'),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(),n("span",{class:"token function-variable function"},"submitClick"),a(),n("span",{class:"token operator"},"="),a(),n("span",{class:"token keyword"},"function"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layer`),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"open"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"1"),n("span",{class:"token punctuation"},","),a(`
|
||
|
title`),n("span",{class:"token operator"},":"),n("span",{class:"token string"},'"\u8868\u5355\u7ED3\u679C"'),n("span",{class:"token punctuation"},","),a(`
|
||
|
content`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token template-string"},[n("span",{class:"token template-punctuation string"},"`"),n("span",{class:"token string"},'<div style="padding: 10px">'),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("model"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</div>"),n("span",{class:"token template-punctuation string"},"`")]),n("span",{class:"token punctuation"},","),a(`
|
||
|
shade`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"false"),n("span",{class:"token punctuation"},","),a(`
|
||
|
isHtmlFragment`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"true"),n("span",{class:"token punctuation"},","),a(`
|
||
|
btn `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"["),n("span",{class:"token punctuation"},"{"),a(" text"),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'\u786E\u8BA4'"),n("span",{class:"token punctuation"},","),a(),n("span",{class:"token function"},"callback"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},"index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(" layer"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"close"),n("span",{class:"token punctuation"},"("),a("index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"]"),n("span",{class:"token punctuation"},","),a(`
|
||
|
area `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'500px'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
model`),n("span",{class:"token punctuation"},","),a(`
|
||
|
submitClick
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("script")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`)])],-1),G=a("\u5199\u4F5C"),K=a("\u753B\u753B"),L=a("\u7F16\u7801"),Q=a("\u63D0\u4EA4"),W=n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form")]),a(),n("span",{class:"token attr-name"},":model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"ref"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("layFormRef"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"required"),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u8D26\u6237"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel.username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u5BC6\u7801"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("password"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel.password"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"type"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("password"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(">"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7231\u597D"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("hobby"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel.hobby"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"multiple"),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select-option")]),a(),n("span",{class:"token attr-name"},"value"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("1"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u5B66\u4E60"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select-option")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select-option")]),a(),n("span",{class:"token attr-name"},"value"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("2"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7F16\u7801"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select-option")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-select-option")]),a(),n("span",{class:"token attr-name"},"value"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("3"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u8FD0\u52A8"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select-option")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-select")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7279\u957F"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-radio")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel.specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"name"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("1"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u5199\u4F5C"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-radio")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-radio")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel.specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"name"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("2"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u753B\u753B"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-radio")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-radio")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel.specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"name"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("specialty"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("3"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u7F16\u7801"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-radio")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u63CF\u8FF0"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("desc"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-textarea")]),a(),n("span",{class:"token attr-name"},"placeholder"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u8BF7\u8F93\u5165\u63CF\u8FF0"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validateModel.desc"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-textarea")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-button")]),a(),n("span",{class:"token attr-name"},"@click"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validate"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u63D0\u4EA4"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-button")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-button")]),a(),n("span",{class:"token attr-name"},"@click"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("clearValidate"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u6E05\u9664\u6821\u9A8C"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-button")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-button")]),a(),n("span",{class:"token attr-name"},"@click"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("reset"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u91CD\u7F6E\u8868\u5355"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-button")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("script")]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token script"},[n("span",{class:"token language-javascript"},[a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a(" ref"),n("span",{class:"token punctuation"},","),a(" reactive "),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'vue'"),a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a("layer"),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'@layui/layer-vue'"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"export"),a(),n("span",{class:"token keyword"},"default"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"setup"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" validateModel "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"reactive"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
username`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
password`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
specialty`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'"1"'),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" layFormRef "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"ref"),n("span",{class:"token punctuation"},"("),n("span",{class:"token keyword"},"null"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token comment"},"// \u6821\u9A8C"),a(`
|
||
|
`),n("span",{class:"token keyword"},"const"),a(),n("span",{class:"token function-variable function"},"validate"),a(),n("span",{class:"token operator"},"="),a(),n("span",{class:"token keyword"},"function"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layFormRef`),n("span",{class:"token punctuation"},"."),a("value"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"validate"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("isValidate"),n("span",{class:"token punctuation"},","),a(" model"),n("span",{class:"token punctuation"},","),a(" errors")]),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token operator"},"=>"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layer`),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"open"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"1"),n("span",{class:"token punctuation"},","),a(`
|
||
|
title`),n("span",{class:"token operator"},":"),n("span",{class:"token string"},'"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C"'),n("span",{class:"token punctuation"},","),a(`
|
||
|
content`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token template-string"},[n("span",{class:"token template-punctuation string"},"`"),n("span",{class:"token string"},'<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : '),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),a("isValidate"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p> <p>\u8868\u5355\u6570\u636E : "),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("model"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"}," </p> <p>\u9519\u8BEF\u4FE1\u606F : "),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("errors"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p></div>"),n("span",{class:"token template-punctuation string"},"`")]),n("span",{class:"token punctuation"},","),a(`
|
||
|
shade`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"false"),n("span",{class:"token punctuation"},","),a(`
|
||
|
isHtmlFragment`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"true"),n("span",{class:"token punctuation"},","),a(`
|
||
|
btn `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"["),n("span",{class:"token punctuation"},"{"),a(" text"),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'\u786E\u8BA4'"),n("span",{class:"token punctuation"},","),a(),n("span",{class:"token function"},"callback"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},"index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(" layer"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"close"),n("span",{class:"token punctuation"},"("),a("index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"]"),n("span",{class:"token punctuation"},","),a(`
|
||
|
area `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'500px'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
|
||
|
`),n("span",{class:"token comment"},"// \u6E05\u9664\u6821\u9A8C"),a(`
|
||
|
`),n("span",{class:"token keyword"},"const"),a(),n("span",{class:"token function-variable function"},"clearValidate"),a(),n("span",{class:"token operator"},"="),a(),n("span",{class:"token keyword"},"function"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layFormRef`),n("span",{class:"token punctuation"},"."),a("value"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"clearValidate"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
|
||
|
`),n("span",{class:"token comment"},"// \u91CD\u7F6E\u8868\u5355"),a(`
|
||
|
`),n("span",{class:"token keyword"},"const"),a(),n("span",{class:"token function-variable function"},"reset"),a(),n("span",{class:"token operator"},"="),a(),n("span",{class:"token keyword"},"function"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layFormRef`),n("span",{class:"token punctuation"},"."),a("value"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"reset"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
validateModel`),n("span",{class:"token punctuation"},"."),a("specialty "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token string"},'"1"'),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
validateModel`),n("span",{class:"token punctuation"},","),a(`
|
||
|
layFormRef`),n("span",{class:"token punctuation"},","),a(`
|
||
|
validate`),n("span",{class:"token punctuation"},","),a(`
|
||
|
clearValidate`),n("span",{class:"token punctuation"},","),a(`
|
||
|
reset
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("script")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`)])],-1),X=a(">"),Y=a("\u5199\u4F5C"),Z=a("\u753B\u753B"),nn=a("\u7F16\u7801"),an=a("\u63D0\u4EA4"),tn=a("\u6E05\u9664\u6821\u9A8C"),sn=a("\u91CD\u7F6E\u8868\u5355"),on=n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form")]),a(),n("span",{class:"token attr-name"},":model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo1"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"ref"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("layFormRef1"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},":rules"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("rules"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"required"),a(),n("span",{class:"token attr-name"},"initValidate"),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u90AE\u7BB1"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("email"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo1.email"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("url\u8DEF\u5F84"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("url"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo1.url"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u65E5\u671F"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("date"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo1.date"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7528\u6237\u540D"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo1.username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u5E74\u9F84"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("age"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo1.age"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-button")]),a(),n("span",{class:"token attr-name"},"@click"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validate1"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u63D0\u4EA4"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-button")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("script")]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token script"},[n("span",{class:"token language-javascript"},[a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a(" ref"),n("span",{class:"token punctuation"},","),a(" reactive "),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'vue'"),a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a("layer"),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'@layui/layer-vue'"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"export"),a(),n("span",{class:"token keyword"},"default"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"setup"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" ruleDemo1 "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"reactive"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
email`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
url`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
date`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
username`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
age`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token keyword"},"null"),n("span",{class:"token punctuation"},","),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" rules "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"ref"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
email `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'email'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},","),a(`
|
||
|
url `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'url'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},","),a(`
|
||
|
date `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'date'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},","),a(`
|
||
|
username `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type `),n("span",{class:"token operator"},":"),a(" "),n("span",{class:"token string"},"'string'"),n("span",{class:"token punctuation"},","),a(`
|
||
|
min `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"8"),n("span",{class:"token punctuation"},","),a(`
|
||
|
max `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"16"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},","),a(`
|
||
|
age `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"validator"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("rule"),n("span",{class:"token punctuation"},","),a(" value"),n("span",{class:"token punctuation"},","),a(" callback"),n("span",{class:"token punctuation"},","),a(" source"),n("span",{class:"token punctuation"},","),a(" options")]),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token keyword"},"if"),a(),n("span",{class:"token punctuation"},"("),a("value "),n("span",{class:"token operator"},"<"),a(),n("span",{class:"token number"},"18"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"callback"),n("span",{class:"token punctuation"},"("),n("span",{class:"token keyword"},"new"),a(),n("span",{class:"token class-name"},"Error"),n("span",{class:"token punctuation"},"("),n("span",{class:"token template-string"},[n("span",{class:"token template-punctuation string"},"`"),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),a("rule"),n("span",{class:"token punctuation"},"."),a("field"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"\u592A\u8FC7\u4E8E\u5E74\u8F7B"),n("span",{class:"token template-punctuation string"},"`")]),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"else"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token boolean"},"true"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" layFormRef1 "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"ref"),n("span",{class:"token punctuation"},"("),n("span",{class:"token keyword"},"null"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token comment"},"// \u6821\u9A8C"),a(`
|
||
|
`),n("span",{class:"token keyword"},"const"),a(),n("span",{class:"token function-variable function"},"validate1"),a(),n("span",{class:"token operator"},"="),a(),n("span",{class:"token keyword"},"function"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layFormRef1`),n("span",{class:"token punctuation"},"."),a("value"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"validate"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("isValidate"),n("span",{class:"token punctuation"},","),a(" model"),n("span",{class:"token punctuation"},","),a(" errors")]),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token operator"},"=>"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layer`),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"open"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"1"),n("span",{class:"token punctuation"},","),a(`
|
||
|
title`),n("span",{class:"token operator"},":"),n("span",{class:"token string"},'"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C"'),n("span",{class:"token punctuation"},","),a(`
|
||
|
content`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token template-string"},[n("span",{class:"token template-punctuation string"},"`"),n("span",{class:"token string"},'<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : '),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),a("isValidate"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p> <p>\u8868\u5355\u6570\u636E : "),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("model"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"}," </p> <p>\u9519\u8BEF\u4FE1\u606F : "),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("errors"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p></div>"),n("span",{class:"token template-punctuation string"},"`")]),n("span",{class:"token punctuation"},","),a(`
|
||
|
shade`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"false"),n("span",{class:"token punctuation"},","),a(`
|
||
|
isHtmlFragment`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"true"),n("span",{class:"token punctuation"},","),a(`
|
||
|
btn `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"["),n("span",{class:"token punctuation"},"{"),a(" text"),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'\u786E\u8BA4'"),n("span",{class:"token punctuation"},","),a(),n("span",{class:"token function"},"callback"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},"index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(" layer"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"close"),n("span",{class:"token punctuation"},"("),a("index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"]"),n("span",{class:"token punctuation"},","),a(`
|
||
|
area `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'500px'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
ruleDemo1`),n("span",{class:"token punctuation"},","),a(`
|
||
|
layFormRef1`),n("span",{class:"token punctuation"},","),a(`
|
||
|
validate1`),n("span",{class:"token punctuation"},","),a(`
|
||
|
rules
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("script")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`)])],-1),en=a("\u63D0\u4EA4"),ln=n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form")]),a(),n("span",{class:"token attr-name"},":model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo2"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"ref"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("layFormRef2"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"required"),a(),n("span",{class:"token attr-name"},"initValidate"),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u90AE\u7BB1"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("email"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},":rules"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("{type : "),n("span",{class:"token punctuation"},"'"),a("email"),n("span",{class:"token punctuation"},"'"),a("}"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo2.email"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("url\u8DEF\u5F84"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("url"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},":rules"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("{type : "),n("span",{class:"token punctuation"},"'"),a("url"),n("span",{class:"token punctuation"},"'"),a("}"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo2.url"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u65E5\u671F"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("date"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},":rules"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("{type : "),n("span",{class:"token punctuation"},"'"),a("date"),n("span",{class:"token punctuation"},"'"),a("}"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo2.date"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u7528\u6237\u540D"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("username"),n("span",{class:"token punctuation"},'"')]),a(`
|
||
|
`),n("span",{class:"token attr-name"},":rules"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a(`{
|
||
|
type : `),n("span",{class:"token punctuation"},"'"),a("string"),n("span",{class:"token punctuation"},"'"),a(`,
|
||
|
min : 8,
|
||
|
max : 16
|
||
|
}`),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo2.username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u5E74\u9F84"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("age"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},":rules"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ageRules"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo2.age"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u81EA\u5B9A\u4E49\u63D0\u793A"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("myEmail"),n("span",{class:"token punctuation"},'"')]),a(`
|
||
|
`),n("span",{class:"token attr-name"},":rules"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a(`{
|
||
|
type : `),n("span",{class:"token punctuation"},"'"),a("email"),n("span",{class:"token punctuation"},"'"),a(`,
|
||
|
message : `),n("span",{class:"token punctuation"},"'"),a("\u5FC5\u987B\u4E3A\u90AE\u7BB1"),n("span",{class:"token punctuation"},"'"),a(`
|
||
|
}`),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("ruleDemo2.myEmail"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-button")]),a(),n("span",{class:"token attr-name"},"@click"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("validate2"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u63D0\u4EA4"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-button")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("script")]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token script"},[n("span",{class:"token language-javascript"},[a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a(" ref"),n("span",{class:"token punctuation"},","),a(" reactive "),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'vue'"),a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a("layer"),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'@layui/layer-vue'"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"export"),a(),n("span",{class:"token keyword"},"default"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"setup"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" ruleDemo2 "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"reactive"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
email`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
url`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
date`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
username`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
age`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token keyword"},"null"),n("span",{class:"token punctuation"},","),a(`
|
||
|
myEmail`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" ageRules "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"validator"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("rule"),n("span",{class:"token punctuation"},","),a(" value"),n("span",{class:"token punctuation"},","),a(" callback"),n("span",{class:"token punctuation"},","),a(" source"),n("span",{class:"token punctuation"},","),a(" options")]),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token keyword"},"if"),a(),n("span",{class:"token punctuation"},"("),a("value "),n("span",{class:"token operator"},"<"),a(),n("span",{class:"token number"},"18"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"callback"),n("span",{class:"token punctuation"},"("),n("span",{class:"token keyword"},"new"),a(),n("span",{class:"token class-name"},"Error"),n("span",{class:"token punctuation"},"("),n("span",{class:"token template-string"},[n("span",{class:"token template-punctuation string"},"`"),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),a("rule"),n("span",{class:"token punctuation"},"."),a("field"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"\u592A\u8FC7\u4E8E\u5E74\u8F7B"),n("span",{class:"token template-punctuation string"},"`")]),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token boolean"},"false"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token boolean"},"true"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" layFormRef2 "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"ref"),n("span",{class:"token punctuation"},"("),n("span",{class:"token keyword"},"null"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token comment"},"// \u6821\u9A8C"),a(`
|
||
|
`),n("span",{class:"token keyword"},"const"),a(),n("span",{class:"token function-variable function"},"validate2"),a(),n("span",{class:"token operator"},"="),a(),n("span",{class:"token keyword"},"function"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layFormRef2`),n("span",{class:"token punctuation"},"."),a("value"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"validate"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("isValidate"),n("span",{class:"token punctuation"},","),a(" model"),n("span",{class:"token punctuation"},","),a(" errors")]),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token operator"},"=>"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layer`),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"open"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"1"),n("span",{class:"token punctuation"},","),a(`
|
||
|
title`),n("span",{class:"token operator"},":"),n("span",{class:"token string"},'"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C"'),n("span",{class:"token punctuation"},","),a(`
|
||
|
content`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token template-string"},[n("span",{class:"token template-punctuation string"},"`"),n("span",{class:"token string"},'<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : '),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),a("isValidate"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p> <p>\u8868\u5355\u6570\u636E : "),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("model"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"}," </p> <p>\u9519\u8BEF\u4FE1\u606F : "),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("errors"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p></div>"),n("span",{class:"token template-punctuation string"},"`")]),n("span",{class:"token punctuation"},","),a(`
|
||
|
shade`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"false"),n("span",{class:"token punctuation"},","),a(`
|
||
|
isHtmlFragment`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"true"),n("span",{class:"token punctuation"},","),a(`
|
||
|
btn `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"["),n("span",{class:"token punctuation"},"{"),a(" text"),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'\u786E\u8BA4'"),n("span",{class:"token punctuation"},","),a(),n("span",{class:"token function"},"callback"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},"index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(" layer"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"close"),n("span",{class:"token punctuation"},"("),a("index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"]"),n("span",{class:"token punctuation"},","),a(`
|
||
|
area `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'500px'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
ruleDemo2`),n("span",{class:"token punctuation"},","),a(`
|
||
|
layFormRef2`),n("span",{class:"token punctuation"},","),a(`
|
||
|
validate2`),n("span",{class:"token punctuation"},","),a(`
|
||
|
ageRules
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("script")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`)])],-1),pn=a("\u63D0\u4EA4"),cn=n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form")]),a(),n("span",{class:"token attr-name"},"@submit"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("submit"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},":model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("submitModel"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"requiredIcons"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("layui-icon-heart-fill"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},":use-CN"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("false"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"required"),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u8D26\u6237"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("template")]),a(),n("span",{class:"token attr-name"},"#label"),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("i")]),a(),n("span",{class:"token attr-name"},"class"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("layui-icon layui-icon-username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("i")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
\u8D26\u6237
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("submitModel.username"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),a(),n("span",{class:"token attr-name"},"label"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("\u5BC6\u7801"),n("span",{class:"token punctuation"},'"')]),a(),n("span",{class:"token attr-name"},"prop"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("password"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-input")]),a(),n("span",{class:"token attr-name"},"v-model"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("submitModel.password"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-input")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("lay-button")]),a(),n("span",{class:"token attr-name"},"native-type"),n("span",{class:"token attr-value"},[n("span",{class:"token punctuation attr-equals"},"="),n("span",{class:"token punctuation"},'"'),a("submit"),n("span",{class:"token punctuation"},'"')]),n("span",{class:"token punctuation"},">")]),a("\u63D0\u4EA4"),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-button")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form-item")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("lay-form")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("template")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
|
||
|
`),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"<"),a("script")]),n("span",{class:"token punctuation"},">")]),n("span",{class:"token script"},[n("span",{class:"token language-javascript"},[a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a(" ref"),n("span",{class:"token punctuation"},","),a(" reactive "),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'vue'"),a(`
|
||
|
`),n("span",{class:"token keyword"},"import"),a(),n("span",{class:"token punctuation"},"{"),a("layer"),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"from"),a(),n("span",{class:"token string"},"'@layui/layer-vue'"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"export"),a(),n("span",{class:"token keyword"},"default"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"setup"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(" submitModel "),n("span",{class:"token operator"},"="),a(),n("span",{class:"token function"},"reactive"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
username`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),n("span",{class:"token punctuation"},","),a(`
|
||
|
password`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},'""'),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"const"),a(),n("span",{class:"token function-variable function"},"submit"),a(),n("span",{class:"token operator"},"="),a(),n("span",{class:"token keyword"},"function"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("isValidate"),n("span",{class:"token punctuation"},","),a(" model"),n("span",{class:"token punctuation"},","),a(" errors")]),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
layer`),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"open"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"1"),n("span",{class:"token punctuation"},","),a(`
|
||
|
title`),n("span",{class:"token operator"},":"),n("span",{class:"token string"},'"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C"'),n("span",{class:"token punctuation"},","),a(`
|
||
|
content`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token template-string"},[n("span",{class:"token template-punctuation string"},"`"),n("span",{class:"token string"},'<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : '),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),a("isValidate"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p> <p>\u8868\u5355\u6570\u636E : "),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("model"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"}," </p> <p>\u9519\u8BEF\u4FE1\u606F : </br>"),n("span",{class:"token interpolation"},[n("span",{class:"token interpolation-punctuation punctuation"},"${"),n("span",{class:"token constant"},"JSON"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"stringify"),n("span",{class:"token punctuation"},"("),a("errors"),n("span",{class:"token punctuation"},")"),n("span",{class:"token interpolation-punctuation punctuation"},"}")]),n("span",{class:"token string"},"</p></div>"),n("span",{class:"token template-punctuation string"},"`")]),n("span",{class:"token punctuation"},","),a(`
|
||
|
shade`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"false"),n("span",{class:"token punctuation"},","),a(`
|
||
|
isHtmlFragment`),n("span",{class:"token operator"},":"),a(),n("span",{class:"token boolean"},"true"),n("span",{class:"token punctuation"},","),a(`
|
||
|
btn `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"["),n("span",{class:"token punctuation"},"{"),a(" text"),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'\u786E\u8BA4'"),n("span",{class:"token punctuation"},","),a(),n("span",{class:"token function"},"callback"),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},"index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(" layer"),n("span",{class:"token punctuation"},"."),n("span",{class:"token function"},"close"),n("span",{class:"token punctuation"},"("),a("index"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},"]"),n("span",{class:"token punctuation"},","),a(`
|
||
|
area `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token string"},"'500px'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
submitModel
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])]),n("span",{class:"token tag"},[n("span",{class:"token tag"},[n("span",{class:"token punctuation"},"</"),a("script")]),n("span",{class:"token punctuation"},">")]),a(`
|
||
|
`)])],-1),un=n("i",{class:"layui-icon layui-icon-username"},null,-1),kn=a(" \u8D26\u6237 "),rn=a("\u63D0\u4EA4"),dn=n("table",null,[n("thead",null,[n("tr",null,[n("th",null,"\u5C5E\u6027"),n("th",null,"\u63CF\u8FF0"),n("th",null,"\u7C7B\u578B"),n("th",null,"\u53EF\u9009\u503C"),n("th",null,"\u9ED8\u8BA4\u503C")])]),n("tbody",null,[n("tr",null,[n("td",null,"v-model"),n("td",null,"\u8868\u5355\u7ED1\u5B9A\u503C"),n("td",null,[n("code",null,"object")]),n("td",null,"-"),n("td",null,"{}")]),n("tr",null,[n("td",null,"required"),n("td",null,"\u662F\u5426\u5FC5\u586B"),n("td",null,[n("code",null,"boolean")]),n("td",null,[n("code",null,"true"),a(),n("code",null,"false")]),n("td",null,[n("code",null,"false")])]),n("tr",null,[n("td",null,"rules"),n("td",null,[a("\u8868\u5355\u6821\u9A8C\u89C4\u5219; "),n("br"),a("\u53EF\u67E5\u770B"),n("a",{href:"https://github.com/yiminghe/async-validator"},"async-validator")]),n("td",null,[n("code",null,"object")]),n("td",null,"-"),n("td",null,"-")]),n("tr",null,[n("td",null,"initValidate"),n("td",null,"\u662F\u5426\u4E00\u5F00\u59CB\u5C31\u6821\u9A8C\u8868\u5355"),n("td",null,[n("code",null,"boolean")]),n("td",null,[n("code",null,"true"),a(),n("code",null,"false")]),n("td",null,[n("code",null,"false")])]),n("tr",null,[n("td",null,"useCN"),n("td",null,"\u662F\u5426\u4F7F\u7528\u4E2D\u6587\u9519\u8BEF\u63D0\u793A"),n("td",null,[n("code",null,"boolean")]),n("td",null,[n("code",null,"true"),a(),n("code",null,"false")]),n("td",null,[n("code",null,"false")])]),n("tr",null,[n("td",null,"requiredIcons"),n("td",null,[a("\u5FC5\u586B\u524D\u7F00\u56FE\u6807"),n("code",null,"class")]),n("td",null,[n("code",null,"string")]),n("td",null,"-"),n("td",null,[n("code",null,"*")])]),n("tr",null,[n("td",null,"required-erroer-message"),n("td",null,"\u5FC5\u586B\u9519\u8BEF\u63D0\u793A\u4FE1\u606F"),n("td",null,[n("code",null,"string")]),n("td",null,"-"),n("td",null,[n("code",null,"%s\u4E0D\u80FD\u4E3A\u7A7A")])]),n("tr",null,[n("td",null,"validate-message"),n("td",null,[a("\u81EA\u5B9A\u4E49\u6821\u9A8C\u9519\u8BEF\u63D0\u793A\u4FE1\u606F; "),n("br"),a("\u7531\u4E8E\u5185\u7F6E\u4E86\u4E2D\u6587\u9519\u8BEF\u63D0\u793A\uFF0C\u53EF\u6309\u9700\u6C42\u589E\u91CF\u589E\u52A0"),n("br"),a("\u53EF\u67E5\u770B "),n("a",{href:"https://github.com/yiminghe/async-validator/blob/master/src/messages.ts"},"async-validator \u5185\u7F6E\u9519\u8BEF\u63D0\u793A"),n("br"),a("\u4E5F\u53EF\u53C2\u8003 "),n("a",{href:"https://gitee.com/layui-vue/layui-vue/tree/develop/src/module/formItem/cnValidateMessage.ts"},"layui-vue \u5185\u7F6E\u4E2D\u6587\u9519\u8BEF\u63D0\u793A")]),n("td",null,[n("code",null,"string")]),n("td",null,"-"),n("td",null,[n("code",null,"%s\u4E0D\u80FD\u4E3A\u7A7A")])])])],-1),mn=n("table",null,[n("thead",null,[n("tr",null,[n("th",null,"\u5C5E\u6027"),n("th",null,"\u63CF\u8FF0"),n("th",null,"\u56DE\u8C03\u53C2\u6570")])]),n("tbody",null,[n("tr",null,[n("td",null,"submit"),n("td",null,[a("\u63D0\u4EA4\u4E8B\u4EF6"),n("code",null,"(\u4E0D\u63A8\u8350\u4F7F\u7528)")]),n("td",null,[a("("),n("code",null,"isValidate"),a(", "),n("code",null,"model"),a(", "),n("code",null,"errors"),a(")"),n("br"),n("br"),a(),n("code",null,"isValidate"),a(": ("),n("code",null,"boolean"),a(")\u662F\u5426\u6821\u9A8C\u901A\u8FC7"),n("br"),n("br"),a(),n("code",null,"model"),a(": ("),n("code",null,"object"),a(")\u8868\u5355\u7ED1\u5B9A\u7684\u503C"),n("br"),n("br"),a(),n("code",null,"errors"),a(": ("),n("code",null,"Array"),a(")\u6821\u9A8C\u7ED3\u679C\u7684\u9519\u8BEF\u4FE1\u606F")])])])],-1),gn=n("table",null,[n("thead",null,[n("tr",null,[n("th",null,"\u5C5E\u6027"),n("th",null,"\u63CF\u8FF0"),n("th",null,"\u5165\u53C2")])]),n("tbody",null,[n("tr",null,[n("td",null,"validate"),n("td",null,[a("\u8868\u5355\u6821\u9A8C; "),n("br"),a("\u5982\u679C\u6CA1\u6709"),n("code",null,"callback"),a("\u56DE\u8C03\uFF0C\u4F1A\u8FD4\u56DE"),n("code",null,"Promise"),a(", "),n("br"),a(),n("code",null,"Promise"),a("\u53C2\u6570\u4E3A{"),n("code",null,"isValidate"),a(", "),n("code",null,"model"),a(", "),n("code",null,"errors"),a("}"),n("br"),a(" \u53C2\u6570\u5177
|
||
|
`),n("span",{class:"token function-variable function"},"validator"),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("rule"),n("span",{class:"token punctuation"},","),a(" value")]),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token operator"},"=>"),a(" value "),n("span",{class:"token operator"},"==="),a(),n("span",{class:"token string"},"'root'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])])],-1),wn=n("div",{class:"language-javascript"},[n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function-variable function"},"asyncValidator"),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("rule"),n("span",{class:"token punctuation"},","),a(" value")]),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token operator"},"=>"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token keyword"},"return"),a(),n("span",{class:"token keyword"},"new"),a(),n("span",{class:"token class-name"},"Promise"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},"("),n("span",{class:"token parameter"},[a("resolve"),n("span",{class:"token punctuation"},","),a(" reject")]),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token operator"},"=>"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token keyword"},"if"),a(),n("span",{class:"token punctuation"},"("),a("value "),n("span",{class:"token operator"},"<"),a(),n("span",{class:"token number"},"18"),n("span",{class:"token punctuation"},")"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"reject"),n("span",{class:"token punctuation"},"("),n("span",{class:"token string"},"'too young'"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(" "),n("span",{class:"token comment"},"// reject with error message"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(),n("span",{class:"token keyword"},"else"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
`),n("span",{class:"token function"},"resolve"),n("span",{class:"token punctuation"},"("),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},")"),n("span",{class:"token punctuation"},";"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])])],-1),xn=n("div",{class:"language-javascript"},[n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token punctuation"},"{"),a(`
|
||
|
key `),n("span",{class:"token operator"},":"),a(" rule "),n("span",{class:"token comment"},"// key\u4E3A\u8868\u5355\u5B50\u9879\u9700\u8981\u6821\u9A8C\u7684\u5BF9\u5E94key\u540D\u79F0\uFF0C rule\u4E3A\u6821\u9A8C\u89C4\u5219\uFF0C\u683C\u5F0F\u4E3A{}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token comment"},"// \u4F8B\u5982 \u8868\u5355\u7ED1\u5B9A\u503C\u4E3A {email : 'xxx', username: 'xxxxx'}"),a(`
|
||
|
`),n("span",{class:"token comment"},"// \u9700\u8981\u6821\u9A8C\u90AE\u7BB1,\u800C\u90AE\u7BB1\u8F93\u5165\u6846\u5728\u8868\u5355\u7ED1\u5B9A\u7684\u503C\u4E2Dkey\u4E3Aemail\uFF0C"),a(`
|
||
|
`),n("span",{class:"token comment"},"// \u9700\u8981\u6821\u9A8C\u7528\u6237\u540D\u957F\u5EA6\u4E3A8\u523016\u4E4B\u95F4,\u800C\u7528\u6237\u540D\u8F93\u5165\u6846\u5728\u8868\u5355\u7ED1\u5B9A\u7684\u503C\u4E2Dkey\u4E3Ausername\uFF0C"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
email `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type `),n("span",{class:"token operator"},":"),a(" "),n("span",{class:"token string"},"'email'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),n("span",{class:"token punctuation"},","),a(`
|
||
|
username `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type `),n("span",{class:"token operator"},":"),a(" "),n("span",{class:"token string"},"'string'"),n("span",{class:"token punctuation"},","),a(`
|
||
|
min `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"8"),n("span",{class:"token punctuation"},","),a(`
|
||
|
max `),n("span",{class:"token operator"},":"),a(),n("span",{class:"token number"},"16"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])])],-1),Vn=n("div",{class:"language-javascript"},[n("pre",null,[n("code",{"v-pre":""},[n("span",{class:"token comment"},"// \u4F8B\u5982 \u8868\u5355\u7ED1\u5B9A\u503C\u4E3A {email : 'xxx', phone: 'xxxxx'}"),a(`
|
||
|
`),n("span",{class:"token comment"},"// \u9700\u8981\u6821\u9A8C\u90AE\u7BB1,\u800C\u90AE\u7BB1\u8F93\u5165\u6846\u5728\u8868\u5355\u7ED1\u5B9A\u7684\u503C\u4E2Dkey\u4E3Aemail"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"{"),a(`
|
||
|
type `),n("span",{class:"token operator"},":"),a(" "),n("span",{class:"token string"},"'email'"),a(`
|
||
|
`),n("span",{class:"token punctuation"},"}"),a(`
|
||
|
`)])])],-1),Un={setup(hn,{expose:C}){C({frontmatter:{}});let k=V({username:"admin",password:"123456",specialty:"1"}),S=function(){y.open({type:1,title:"\u8868\u5355\u7ED3\u679C",content:`<div style="padding: 10px">${JSON.stringify(k)}</div>`,shade:!1,isHtmlFragment:!0,btn:[{text:"\u786E\u8BA4",callback(r){y.close(r)}}],area:"500px"})},i=V({username:"",password:"",specialty:"1"}),h=$(null),j=function(){h.value.validate((r,e,c)=>{y.open({type:1,title:"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C",content:`<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : ${r}</p> <p>\u8868\u5355\u6570\u636E : ${JSON.stringify(e)} </p> <p>\u9519\u8BEF\u4FE1\u606F : ${JSON.stringify(c)}</p></div>`,shade:!1,isHtmlFragment:!0,btn:[{text:"\u786E\u8BA4",callback(u){y.close(u)}}],area:"500px"})})},D=function(){h.value.clearValidate()},J=function(){h.value.reset(),i.specialty="1"},g=V({email:"",url:"",date:"",username:"",age:null}),M=$({email:{type:"email"},url:{type:"url"},date:{type:"date"},username:{type:"string",min:8,max:16},age:{validator(r,e,c,u,p){if(e<18)c(new Error(`${r.field}\u592A\u8FC7\u4E8E\u5E74\u8F7B`));else return!0}}}),F=$(null),O=function(){F.value.validate((r,e,c)=>{y.open({type:1,title:"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C",content:`<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : ${r}</p> <p>\u8868\u5355\u6570\u636E : ${JSON.stringify(e)} </p> <p>\u9519\u8BEF\u4FE1\u606F : ${JSON.stringify(c)}</p></div>`,shade:!1,isHtmlFragment:!0,btn:[{text:"\u786E\u8BA4",callback(u){y.close(u)}}],area:"500px"})})},d=V({email:"",url:"",date:"",username:"",age:null,myEmail:""}),E={validator(r,e,c,u,p){return e<18?(c(new Error(`${r.field}\u592A\u8FC7\u4E8E\u5E74\u8F7B`)),!1):!0}},U=$(null),H=function(){U.value.validate((r,e,c)=>{y.open({type:1,title:"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C",content:`<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : ${r}</p> <p>\u8868\u5355\u6570\u636E : ${JSON.stringify(e)} </p> <p>\u9519\u8BEF\u4FE1\u606F : ${JSON.stringify(c)}</p></div>`,shade:!1,isHtmlFragment:!0,btn:[{text:"\u786E\u8BA4",callback(u){y.close(u)}}],area:"500px"})})},_=V({username:"",password:""}),I=function(r,e,c){y.open({type:1,title:"\u8868\u5355\u63D0\u4EA4\u7ED3\u679C",content:`<div style="padding: 10px"><p>\u662F\u5426\u901A\u8FC7 : ${r}</p> <p>\u8868\u5355\u6570\u636E : ${JSON.stringify(e)} </p> <p>\u9519\u8BEF\u4FE1\u606F : </br>${JSON.stringify(c)}</p></div>`,shade:!1,isHtmlFragment:!0,btn:[{text:"\u786E\u8BA4",callback(u){y.close(u)}}],area:"500px"})};return(r,e)=>{const c=m("lay-field"),u=m("lay-input"),p=m("lay-form-item"),b=m("lay-select-option"),N=m("lay-select"),q=m("lay-radio"),R=m("lay-textarea"),f=m("lay-button"),w=m("lay-form"),x=m("lay-code"),v=m("lay-table-box"),z=m("lay-comment");return A(),B("div",P,[t(c,{title:"\u57FA\u7840\u4F7F\u7528",style:{"margin-top":"20px","margin-bottom":"20px"}}),t(x,null,{code:o(()=>[T]),default:o(()=>[t(w,{model:s(k)},{default:o(()=>[t(p,{label:"\u8D26\u6237",prop:"username"},{default:o(()=>[t(u,{modelValue:s(k).username,"onUpdate:modelValue":e[0]||(e[0]=l=>s(k).username=l)},null,8,["modelValue"])]),_:1}),t(p,{label:"\u5BC6\u7801",prop:"password"},{default:o(()=>[t(u,{modelValue:s(k).password,"onUpdate:modelValue":e[1]||(e[1]=l=>s(k).password=l),type:"password"},null,8,["modelValue"])]),_:1}),t(p,{label:"\u7231\u597D",prop:"hobby"},{default:o(()=>[t(N,{modelValue:s(k).hobby,"onUpdate:modelValue":e[2]||(e[2]=l=>s(k).hobby=l)},{default:o(()=>[t(b,{value:"1",label:"\u5B66\u4E60"}),t(b,{value:"2",label:"\u7F16\u7801"}),t(b,{value:"3",label:"\u8FD0\u52A8"})]),_:1},8,["modelValue"])]),_:1}),t(p,{label:"\u7279\u957F",prop:"specialty"},{default:o(()=>[t(q,{modelValue:s(k).specialty,"onUpdate:modelValue":e[3]||(e[3]=l=>s(k).specialty=l),name:"specialty",label:"1"},{default:o(()=>[G]),_:1},8,["modelValue"]),t(q,{modelValue:s(k).specialty,"onUpdate:modelValue":e[4]||(e[4]=l=>s(k).specialty=l),name:"specialty",label:"2"},{default:o(()=>[K]),_:1},8,["modelValue"]),t(q,{modelValue:s(k).specialty,"onUpdate:modelValue":e[5]||(e[5]=l=>s(k).specialty=l),name:"specialty",label:"3"},{default:o(()=>[
|