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>
  • 相关阅读:
    (转)用JMX监测JVM的运行参数
    MySql
    ORACLE小工具:存储过程清空所有表或使所有触发器失效
    简单易懂,原码,补码,反码
    centos7如何关闭防火墙
    中兴大事件
    苹果降频门:旧款iPhone哪些功能受到影响
    苹果降频门
    华为P10闪存门
    N32903系列的基础知识(1)
  • 原文地址:https://www.cnblogs.com/yebai/p/15684561.html
Copyright © 2011-2022 走看看