Browse Source

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

pull/1406/head
贤心 1 year ago
parent
commit
2f511014c3
  1. 14
      src/modules/table.js

14
src/modules/table.js

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

Loading…
Cancel
Save