优化 table 单选框在特殊场景下的选中逻辑

pull/1406/head
贤心 1 year ago
parent 714fa8969a
commit 2f511014c3

@ -1593,16 +1593,12 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
radio: 'layTableRadio', radio: 'layTableRadio',
checkbox: 'layTableCheckbox' checkbox: 'layTableCheckbox'
}[opts.type] || 'checkbox') +'"]:not(:disabled)'); }[opts.type] || 'checkbox') +'"]:not(:disabled)');
var checkedSameElem = checkedElem.last(); var checkedSameElem = checkedElem.last();
if (opts.type === 'radio' && checkedSameElem.parents(ELEM_FIXR)[0]) { var fixRElem = checkedSameElem.closest(ELEM_FIXR);
if (checkedSameElem.parents(ELEM_FIXR).hasClass('layui-hide')) {
checkedSameElem = checkedElem.first(); ( opts.type === 'radio' && fixRElem.hasClass(HIDE)
} ? checkedElem.first()
checkedSameElem.prop('checked', true); : checkedElem ).prop('checked', getChecked(checkedSameElem.prop('checked')));
} else {
checkedElem.prop('checked', getChecked(checkedSameElem.prop('checked')));
}
that.syncCheckAll(); that.syncCheckAll();
that.renderForm(opts.type); that.renderForm(opts.type);

Loading…
Cancel
Save