ant-design/components/tree/demo/line.md
zombieJ 8114516496
feat: Tree support virtual scroll (#18172)
* update tree deps

* add part of style

* flex grid

* update disabled

* update demo

* second demo

* add draggable style

* update demo

* update rc-tree version

* temp md

* update tree deps

* update icon demo

* update style

* update less

* update deps

* clean up

* update test case

* fix show line

* update snapshot

* fix lint

* update style

* update deps
2019-08-12 13:22:36 +08:00

1.0 KiB

order title
5
zh-CN en-US
连接线 Tree With Line

zh-CN

带连接线的树。

en-US

Tree With Line

import { Tree } from 'antd';

const treeData = [
  {
    title: 'parent 1',
    key: '0-0',
    children: [
      {
        title: 'parent 1-0',
        key: '0-0-0',
        children: [
          { title: 'leaf', key: '0-0-0-0' },
          { title: 'leaf', key: '0-0-0-1' },
          { title: 'leaf', key: '0-0-0-2' },
        ],
      },
      {
        title: 'parent 1-1',
        key: '0-0-1',
        children: [{ title: 'leaf', key: '0-0-1-0' }],
      },
      {
        title: 'parent 1-2',
        key: '0-0-2',
        children: [{ title: 'leaf', key: '0-0-2-0' }, { title: 'leaf', key: '0-0-2-1' }],
      },
    ],
  },
];

const Demo: React.FC<{}> = () => {
  const onSelect = (selectedKeys, info) => {
    console.log('selected', selectedKeys, info);
  };

  return <Tree showLine defaultExpandedKeys={['0-0-0']} onSelect={onSelect} treeData={treeData} />;
};

ReactDOM.render(<Demo />, mountNode);