博客
关于我
Ant Design中Tree组件使用
阅读量:335 次
发布时间:2019-03-04

本文共 2468 字,大约阅读时间需要 8 分钟。

import React, { Component } from 'react'import { Tree } from 'antd'const { DirectoryTree } = Tree;export default class TreeComponent extends Component {    state = {}    getTreeData = () => {        return [            {                title: '机构一',                key: '0-0',                children: [                    {                        title: '用户一',                        key: '0-0-0',                        isLeaf: true                    },                    {                        title: '用户二',                        key: '0-0-1',                        isLeaf: true                    },                    {                        title: '用户三',                        key: '0-0-2',                        isLeaf: true                    },                    {                        title: '用户四',                        key: '0-0-3',                        isLeaf: true                    },                    {                        title: '用户五',                        key: '0-0-4',                        isLeaf: true                    },                    {                        title: '用户六',                        key: '0-0-5',                        isLeaf: true                    }                ]            },            {                title: '机构二',                key: '0-1',                children: [                    {                        title: '用户七',                        key: '0-1-0',                        isLeaf: true                    },                    {                        title: '用户八',                        key: '0-1-1',                        isLeaf: true                    },                    {                        title: '用户九',                        key: '0-1-2',                        isLeaf: true                    },                    {                        title: '用户十',                        key: '0-1-3',                        isLeaf: true                    }                ]            }        ];    }    onSelect = (selectedKeys, info) => {        console.log('selected', selectedKeys, info);    };    onCheck = (checkedKeys, info) => {        console.log('onCheck', checkedKeys, info);    };    componentWillMount() {        this.treeData = this.getTreeData();    }    render() {        return (            
); }}

优化说明:

  • 删除了无效的HTML标签和空白内容
  • 使用更简洁的代码格式,符合技术文档标准
  • 保留了核心功能模块的必要描述
  • 使用更专业的技术术语
  • 保持了代码的可读性和可维护性
  • 删除了不影响功能的默认属性设置
  • 保持了与原代码一致的核心功能
  • 转载地址:http://umvq.baihongyu.com/

    你可能感兴趣的文章
    Python3学习笔记3,变量、运算符
    查看>>
    Python3学习笔记(urllib模块的使用)
    查看>>
    python3安装scapy_Linux下安装scapy-python3
    查看>>
    python3实现socket通信
    查看>>
    Python关于numpy.transpose函数详细解析附代码
    查看>>
    Python3导入自定义模块的3种方式
    查看>>
    python3打开txt文件_使用Python 3从文本文件读取句子并添加到列表中
    查看>>
    python3爬虫抓取智联招聘职位信息代码
    查看>>
    Python3爬虫数据入数据库---把爬取到的数据存到数据库,带数据库去重功能
    查看>>
    python3的 pymysql把mysqldb库取代了,让python 3支持mysqldb的解决方法
    查看>>
    Python3笔记——IDE的选择
    查看>>
    python3简单使用requests 用户代理,cookie池
    查看>>
    Python3组播通信编程实现教程(发送者+接收者)
    查看>>
    Python3编写网络爬虫10-数据存储方式三-CSV文件存储
    查看>>
    python3读取redis返回数据带有'b'的问题
    查看>>
    Python3连接MySQL
    查看>>
    Python关于isinstance函数的解析 | 附Demo(全)
    查看>>
    Python3:setup.py:完成所有任务的PIP安装(Build_ext+Install)
    查看>>
    python4.0 gil_Python 并发编程系列--1、浅谈GIL历史及对多线程的影响
    查看>>
    python60行绘图程序_天底下最简单的QT画图板,就一个类,60行代码
    查看>>