姓名:<input type="text" required="" lay-verify="required|chineseName" autocomplete="off" class="layui-input" >
layui.use(['form'], function () { //自定义验证规则form.verify({chineseName: function (value) {let pattern = /[\u4e00-\u9fa5]/;//中文验证let txt = pattern.test(value); if (value.length < 2 || !txt) {return '姓名必须是中文,且至少2个字符';}},account: [/^[a-z0-9]{6,16}$/, '账号必须6到12位的“数字”或“字母”或数字和字母组合'],//账号password: [/(.+){6,12}$/, '密码必须6到12位'],//密码redoPassword: function (value) {if ($('#PassWord').val() != $('#re_PassWord').val()) {return '两次密码不一致';}},minLength: function (value) { //最小长度验证if (value.length < 2) {return '长度不合法';}}});});