Merge branch '2.x' of github.com:layui/layui into 2.x

pull/1260/head
贤心 2 years ago
commit d3000748fd

@ -690,6 +690,13 @@ layui.define(['lay', 'layer', 'util'], function(exports){
}()));
var disabled = this.disabled;
if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格
var RE_CLASS = CLASS[skin] || CLASS.checkbox;
// 替代元素
var hasRender = othis.next('.' + RE_CLASS[0]);
hasRender[0] && hasRender.remove(); // 如果已经渲染则Rerender
// 若存在标题模板,则优先读取标题模板
if(othis.next('[lay-checkbox]')[0]){
title = othis.next().html() || '';
@ -698,13 +705,9 @@ layui.define(['lay', 'layer', 'util'], function(exports){
// 若为开关,则对 title 进行分隔解析
title = skin === 'switch' ? title.split('|') : [title];
if(!skins[skin]) skin = 'primary'; // 若非内置风格,则强制为默认风格
var RE_CLASS = CLASS[skin] || CLASS.checkbox;
if(typeof othis.attr('lay-ignore') === 'string') return othis.show();
// 替代元素
var hasRender = othis.next('.' + RE_CLASS[0]);
var reElem = $(['<div class="layui-unselect '+ RE_CLASS[0],
(check.checked ? (' '+ RE_CLASS[1]) : ''), // 选中状态
(disabled ? ' layui-checkbox-disabled '+ DISABLED : ''), // 禁用状态
@ -725,7 +728,6 @@ layui.define(['lay', 'layer', 'util'], function(exports){
}(),
'</div>'].join(''));
hasRender[0] && hasRender.remove(); // 如果已经渲染则Rerender
othis.after(reElem);
events.call(this, reElem, RE_CLASS);
});

Loading…
Cancel
Save