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>
  • 相关阅读:
    ubuntu下内核源码树的建立
    删除ubuntu旧版本内核
    设置ubuntu12.04桌面版开机进入命令行模式
    MFC学习笔记(一)向模态对话框传递数据
    redis 映射数据结构粗略
    redis入门
    mybatis总结
    mybatis--mapper配置总结
    mybatis-初步使用
    maven-plugins说明
  • 原文地址:https://www.cnblogs.com/yebai/p/15684561.html
Copyright © 2011-2022 走看看