<el-tree 
        :data="morkDataList" 
        show-checkbox
        ref="tree"
        node-key="id"
        highlight-current>
    </el-tree>

data是要循环遍历的数组对象

show-checkbox是显示勾选
ref="tree"用于默认添加和获取的
node-key="id"同上,唯一标识
获取:
this.$refs.tree.getCheckedNodes().forEach(item=>{
                if(item.children){
                    return
                }
                if(item.id!=''){
                    arr.push(item.id)
                }
            })

默认值:

this.$refs.tree.setCheckedKeys(res.obj);

res.obj也可以直接写成=》[ ],默认为空

 

相关文章:

  • 2021-11-23
  • 2022-12-23
  • 2021-05-05
  • 2021-07-20
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-28
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
相关资源
相似解决方案