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

修复表头属性type:'radio', fixed: 'right'时选择效果无效问题,但是不影响数据返回
pull/1413/head
贤心 2023-10-31 08:32:16 +08:00 committed by GitHub
commit f437d48138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

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