mirror of
https://gitee.com/layui/layui.git
synced 2025-04-05 17:38:02 +08:00
This reverts commit c7452c788a
.
This commit is contained in:
parent
0d17679d01
commit
83503e5e8a
@ -113,7 +113,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
||||
type = itemElem[0].type;
|
||||
|
||||
// 如果为复选框
|
||||
if(itemElem.length === 1 && type === 'checkbox'){
|
||||
if(type === 'checkbox'){
|
||||
itemElem[0].checked = value;
|
||||
} else if(type === 'radio') { // 如果为单选框
|
||||
itemElem.each(function(){
|
||||
@ -154,12 +154,7 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
||||
}
|
||||
|
||||
if(/^(checkbox|radio)$/.test(item.type) && !item.checked) return; // 复选框和单选框未选中,不记录字段
|
||||
var n = init_name || item.name;
|
||||
var v = othis.val();
|
||||
// 相同 name 的字段,将值合并到数组
|
||||
field[n] = field[n] === undefined ? v
|
||||
: $.isArray(field[n]) ? field[n].concat(v)
|
||||
: [field[n], v];
|
||||
field[init_name || item.name] = othis.val();
|
||||
});
|
||||
|
||||
return field;
|
||||
|
Loading…
Reference in New Issue
Block a user