优化 checkbox 的 `title` 对 `lay-text` 属性的兼容

pull/1203/head
贤心 2 years ago
parent a7ce133b89
commit d4fb5d05b0

@ -659,10 +659,9 @@ layui.define(['lay', 'layer', 'util'], function(exports){
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';
var title = (function(title){ var title = $.trim(check.title || function(){ // 向下兼容 lay-text 属性
// 向下兼容 lay-text 属性 return check.title = othis.attr('lay-text') || '';
return title || othis.attr('lay-text') || ''; }()).split('|');
})(check.title).replace(/\s/g, '').split('|');
var disabled = this.disabled; var disabled = this.disabled;
if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格 if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格

Loading…
Cancel
Save