0
点赞
收藏
分享

微信扫一扫

LoRaWAN物联网架构

yongxinz 2023-11-09 阅读 36

 <el-tree
        ref="tree"
        default-expand-all
        highlight-current
        check-on-click-node
        node-key="id"
        :data="treeData"
        :props="defaultProps"
        @node-click="nodeClick"
      >
      </el-tree>

  treeData: [],
      defaultProps: {
        children: "children",
        label: "columnName",
      },

      treeData: [],


    async getTree() {
      let obj = {};
      await columnList()
        .then((res) => {
          if (res.data && res.data.length > 0) {
            this.treeData = handleTree(res.data, "id");
            obj = this.treeData[0];
            this.$nextTick(() => {
              // todo 在这里设置
              this.$refs.tree.setCurrentKey(this.treeData[0].children[1].id)
            })
          } else {
            this.treeData = [];
            obj = {};
          }
          console.log("this.treeData", this.treeData)
        })
        .finally(() => {
          console.log(obj);
          this.nodeClick(obj);
        });
    },


  created() {
    this.getTree();
  },
  // 设置首行高亮效果
  this.$refs.tree.setCurrentKey(this.treeData[0].id)
举报

相关推荐

物联网架构之Hadoop

0 条评论