-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
39 lines (36 loc) · 854 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React from 'react';
import ReactDOM from 'react-dom';
import ReactOrgChart from '../src/index';
let counter = 0;
ReactDOM.render(
<ReactOrgChart
height={'100vh'}
data={{
id: 'root',
name: '产品研发中心',
leaders: [
{
name: '彭伟聪',
avatar: 'https://avatars2.githubusercontent.com/u/13917544?s=460&v=4'
}
],
members: Array.from(Array(10)).map(() => ({
name: '人员',
avatar: ''
})),
hasChildren: true
}}
getChildren={(node) =>
new Promise((resolve) => {
counter++;
resolve(
Array.from(Array(3)).map((_, i) => ({
id: `sub-${counter}-${i}`,
name: '子部门',
hasChildren: true
}))
);
})}
/>,
document.getElementById('root')
);