el-tree 的运用

 <el-tree
                    :data="dataList"
                    show-checkbox
                    :default-expand-all="false"
                    node-key="name"
                    ref="tree"
                    highlight-current
                    :props="defaultProps"
                  >
                  </el-tree>
 
  getCheckedKeys() {
      let shuju = this.$refs.tree.getCheckedKeys();
      let checkNodes = this.$refs.tree.getCheckedNodes();
      let userNames = [];
      checkNodes.map((item) => {
        if (item.children) {
          return;
        }
        userNames.push(item.id);
      });
      // console.log(userNames);
      this.ygsl = userNames.length;
      this.bum = userNames.join(",");
      this.flg = 2;
      this.dialogFormVisible = false;
    },
 
posted @ 2021-06-16 17:36  诡道也  阅读(246)  评论(0编辑  收藏  举报