element中el-tree树子节点全部取消,父节点半选的实现

1、模板:

          
            
          

2、js实现:

    checkChange(a, b, c) {
      const anode = this.$refs.tree.getNode(a)
      !anode.checked ? this.findchildren(anode.parent) : ''
    },
    findchildren(current) {
      const fnode = this.$refs.tree.getNode(current)
      if (!fnode.isLeaf) {
        fnode.indeterminate = true
        fnode.checked = true
      }
    },

3、示例;
element中el-tree树子节点全部取消,父节点半选的实现_第1张图片

你可能感兴趣的:(element-ui)