Skip to content

Commit 76b0b6d

Browse files
committed
fix(Tree):添加Tree树桩展示组件
1 parent 65795be commit 76b0b6d

File tree

5 files changed

+397
-0
lines changed

5 files changed

+397
-0
lines changed

example/examples/src/routes.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,14 @@ export const stackPageData: Routes[] = [
450450
description: '可自定义拖曳抽屉高度',
451451
},
452452
},
453+
{
454+
name: 'Tree',
455+
component: require('./routes/Tree').default,
456+
params: {
457+
title: 'Tree 树形展示',
458+
description: '树形展示',
459+
},
460+
},
453461
{
454462
name: 'TreeSelect',
455463
component: require('./routes/TreeSelect').default,
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import React from 'react';
2+
import {Tree, DragDrawer, Icon} from '@uiw/react-native';
3+
import {ComProps} from '../../routes';
4+
import Layout, {Container} from '../../Layout';
5+
const {Header, Body} = Layout;
6+
7+
export interface TreeViewProps extends ComProps {}
8+
9+
export default class TreeDemo extends React.Component<TreeViewProps> {
10+
render() {
11+
const {route} = this.props;
12+
const description = route.params.description;
13+
const title = route.params.title;
14+
const option = [
15+
{
16+
label: '一栋',
17+
value: '01',
18+
children: [
19+
{
20+
label: '一单元',
21+
value: '01-1',
22+
children: [{label: '一层', value: '01-1-1', children: [{label: '101', value: '01-1-1-1'}]}],
23+
},
24+
{
25+
label: '一单元1',
26+
value: '01-2',
27+
},
28+
{
29+
label: '一单元2',
30+
value: '01-3',
31+
},
32+
],
33+
},
34+
{
35+
label: '二栋',
36+
value: '02',
37+
children: [
38+
{
39+
label: '二单元',
40+
value: '02-1',
41+
},
42+
{
43+
label: '二单元1',
44+
value: '02-2',
45+
},
46+
{
47+
label: '二单元2',
48+
value: '02-3',
49+
},
50+
],
51+
},
52+
];
53+
return (
54+
<Container>
55+
<Layout>
56+
<Header title={title} description={description} />
57+
<React.Fragment>
58+
<Body style={{paddingLeft: 16, paddingRight: 16}}>
59+
<Tree
60+
defaultValue={['01', '01-1', '01-1-1', '01-1-1-1']}
61+
// activeColor="red"
62+
options={option}
63+
onChange={(value: any, nodes: any) => {
64+
console.log(value, nodes);
65+
}}
66+
/>
67+
</Body>
68+
</React.Fragment>
69+
</Layout>
70+
</Container>
71+
);
72+
}
73+
}

packages/core/src/Tree/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Tree } from './tree';
2+
3+
export type { TreeProps, TreeOption } from './tree';
4+
5+
export default Tree;

0 commit comments

Comments
 (0)