zoukankan      html  css  js  c++  java
  • ant design vue atree 树形控件

    话不多说,先上代码。

    <a-tree
          v-if="this.treeData && this.treeData.length > 0"
           ref="tree"
           :treeData="treeData"
            :defaultExpandedKeys="expandedKeys"
             :defaultSelectedKeys="expandedKeys"
             @select="treeSelect"
             :title="title"
           >
           <a-icon slot="switcherIcon" type="down" />
    </a-tree> 
    <script>
    import {getTreeDate, queryTreeDate,DelDate} from "@api/api"
    data() { return { treeData: [], }; },
    created() {
    this.printList(this.$route.query.spaceid);
    this.queryBody(this.$route.query.contentid);
    },
    treeSelect(selectedKeys,e) {
    //获取面包屑
    this.breadList = [];
    // console.log("这是啥",e.node.parent);
    this.title = e.node._props.title
    // this.contentid = e.node.eventKey;
    console.log("这个是key:",e.node.eventKey)
    console.log("这个是key:",e.node.pos)
    this.queryBody(e.node.eventKey);
    },
    queryBody(id){
    if (id!=null){
    this.$router.push({path:'/knowledge/AllUpdates/Details?contentid='+id+'&spaceid='+this.$route.query.spaceid});
    queryTreeDate({"contentid":id}).then((res) => {
    if (res.success) {
    this.title = res.result.title;
    this.content = res.result.body;
    this.name = res.result.lastName;
    this.lastDate = res.result.lastmoddate;
    }
    })
    }
    },
    printList(params,params1){
    console.log(params1)
    getTreeDate({"spaceid":params}).then((res) => {
    if (res.success) {
    this.treeData = res.result;
    console.log(params,params1)
    this.expandedKeys=[this.$route.query.contentid];
    console.log(this.expandedKeys);

    }
    });
    },
      }
    };
    </script>
  • 相关阅读:
    读Android之大话设计模式--前言和说明
    把二叉树打印成多行
    按之字形顺序打印二叉树
    对称的二叉树
    二叉树的下一个结点
    链表中环的入口结点
    字符流中第一个不重复的字符
    表示数值的字符串
    构建乘积数组
    数组中重复的数字
  • 原文地址:https://www.cnblogs.com/yebai/p/15684561.html
Copyright © 2011-2022 走看看