羽落陌殇
羽落陌殇
  • 发布:2021-06-01 15:59
  • 更新:2021-06-01 15:59
  • 阅读:355

修改父级全选后,回显过多,只想回显父级数据怎么操作?

分类:uni-app

如果选中父级,怎么样设置回显只有父级呢?根据评论区的大佬们修改了点击父级可以全选的代码,现在选中父级的话,会将整个系列全部选中

// 处理单选多选  
            _fixMultiple(index) {  
                if (!this.multiple) {  
                    // 如果是单选  
                    this.treeList.forEach((v, i) => {  
                        if (i != index) {  
                            this.treeList[i].checked = false  
                        } else {  
                            this.treeList[i].checked = true  
                        }  
                    })  
                } else {  
                    this.treeList.forEach((obj, i) => {  
                        if (!this.treeList[index].checked && this.treeList[index].parentId.indexOf(obj.id) > -1) {  
                            this.treeList[i].checked = false;  
                        } else if (obj.parentId.indexOf(this.treeList[index].id) > -1) {  
                            this.treeList[i].checked = this.treeList[index].checked;  
                        }  
                    })  
                }  
            },
2021-06-01 15:59 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复