From 9b6426e089ffc5ed81ae87be283d501f1e57bc6a Mon Sep 17 00:00:00 2001 From: morning-star Date: Sun, 19 Mar 2023 00:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20form=20=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E5=A4=8D=E9=80=89=E6=A1=86=E5=92=8C=E5=8D=95=E9=80=89=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/form.js b/src/modules/form.js index 7778dbb8..9b58e18d 100644 --- a/src/modules/form.js +++ b/src/modules/form.js @@ -136,7 +136,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ init_name = item.name.replace(/^(.*)\[\]$/, '$1['+ (nameIndex[key]++) +']'); } - if(/^checkbox|radio$/.test(item.type) && !item.checked) return; // 复选框和单选框未选中,不记录字段 + if(/^(checkbox|radio)$/.test(item.type) && !item.checked) return; // 复选框和单选框未选中,不记录字段 field[init_name || item.name] = item.value; }); @@ -848,7 +848,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){ // 是否属于美化替换后的表单元素 var isForm2Elem = item.tagName.toLowerCase() === 'select' || ( - /^checkbox|radio$/.test(item.type) + /^(checkbox|radio)$/.test(item.type) ); errorText = errorText || rule[1];