|
|
@ -618,12 +618,12 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|
|
|
// 复选框/开关
|
|
|
|
// 复选框/开关
|
|
|
|
,checkbox: function(elem){
|
|
|
|
,checkbox: function(elem){
|
|
|
|
var CLASS = {
|
|
|
|
var CLASS = {
|
|
|
|
checkbox: ['layui-form-checkbox', 'layui-form-checked', 'checkbox']
|
|
|
|
"checkbox": ['layui-form-checkbox', 'layui-form-checked', 'checkbox'],
|
|
|
|
,_switch: ['layui-form-switch', 'layui-form-onswitch', 'switch']
|
|
|
|
"switch": ['layui-form-switch', 'layui-form-onswitch', 'switch']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
,checks = elem || elemForm.find('input[type=checkbox]')
|
|
|
|
var checks = elem || elemForm.find('input[type=checkbox]');
|
|
|
|
|
|
|
|
|
|
|
|
,events = function(reElem, RE_CLASS){
|
|
|
|
var events = function(reElem, RE_CLASS){
|
|
|
|
var check = $(this);
|
|
|
|
var check = $(this);
|
|
|
|
|
|
|
|
|
|
|
|
// 勾选
|
|
|
|
// 勾选
|
|
|
@ -647,20 +647,19 @@ layui.define(['lay', 'layer', 'util'], function(exports){
|
|
|
|
,othis: reElem
|
|
|
|
,othis: reElem
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历复选框
|
|
|
|
checks.each(function(index, check){
|
|
|
|
checks.each(function(index, check){
|
|
|
|
var othis = $(this);
|
|
|
|
var othis = $(this);
|
|
|
|
var skin = othis.attr('lay-skin') || 'primary';
|
|
|
|
var skin = othis.attr('lay-skin') || 'primary';
|
|
|
|
check.title || (check.title = othis.attr('lay-text') || ''); // 向下兼容将以前设置在lay-text的值赋给title
|
|
|
|
var title = (function(title){
|
|
|
|
var title = (check.title.replace(/\s/g, '') || '').split('|');
|
|
|
|
// 向下兼容 lay-text 属性
|
|
|
|
|
|
|
|
return title || othis.attr('lay-text') || '';
|
|
|
|
|
|
|
|
})(check.title).replace(/\s/g, '').split('|');
|
|
|
|
var disabled = this.disabled;
|
|
|
|
var disabled = this.disabled;
|
|
|
|
|
|
|
|
|
|
|
|
if(skin === 'switch') {
|
|
|
|
if(skin !== 'tag') skin = 'primary'; // 若非内置风格,则强制为默认风格
|
|
|
|
skin = '_'+ skin;
|
|
|
|
|
|
|
|
} else if (skin !== 'tag') {
|
|
|
|
|
|
|
|
skin = 'primary';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var RE_CLASS = CLASS[skin] || CLASS.checkbox;
|
|
|
|
var RE_CLASS = CLASS[skin] || CLASS.checkbox;
|
|
|
|
|
|
|
|
|
|
|
|
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
|
|
|
|
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
|
|
|
|