From 641879541dd32bcc03931347dd5c624072ed8ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:58:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20form=20=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/form/examples/form.demo.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/form/examples/form.demo.md b/docs/form/examples/form.demo.md index e83850fe..cdbcb6f9 100644 --- a/docs/form/examples/form.demo.md +++ b/docs/form/examples/form.demo.md @@ -26,7 +26,7 @@
- +
@@ -205,10 +205,11 @@ layui.use(['form', 'laydate', 'util'], function(){ // 自定义验证规则 form.verify({ - pass: [ - /^[\S]{6,12}$/, - '密码必须6到12位,且不能出现空格' - ] + pass: function(value) { + if (!/(.+){6,12}$/.test(value)) { + return '密码必须 6 到 12 位'; + } + } }); // 指定开关事件 @@ -254,4 +255,4 @@ layui.use(['form', 'laydate', 'util'], function(){ } }); }); - \ No newline at end of file +