fix(#I1B42I): 子菜单与父级菜单联动问题

#Issue
close #I1B42I
This commit is contained in:
Argo Zhang 2020-03-09 12:19:03 +08:00
parent b455118844
commit ad05215260
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 10 additions and 6 deletions

View File

@ -142,18 +142,22 @@ $(function () {
$nestMenu.nestMenu(function () {
$nestMenuInput = $nestMenu.find('div.dd3-content');
$nestMenuInput.on('click', ':checkbox', function () {
var val = $(this).prop('checked');
var child = $(this).parents('.dd3-content').next();
var $this = $(this);
var val = $this.prop('checked');
var child = $this.parents('.dd3-content').next();
if (child.hasClass('dd-list')) {
child.find(':checkbox').prop('checked', val);
}
// 子节点全部取消时父级菜单也取消
$(this).parents('ol.dd-list').each(function (index, p) {
if (val === false) {
val = $(p).prev().next().find(':checked').length > 0;
$this.parents('ol.dd-list').each(function (index, p) {
var $menuType = $this.parents('.dd3-item').attr('data-resource');
if ($menuType === "0") {
if (val === false) {
val = $(p).find(':checked').length > 0;
}
$(p).prev().find(':checkbox').prop('checked', val);
}
$(p).prev().find(':checkbox').prop('checked', val);
});
}).children('.radio').hide();
});