Skip to content

Commit 3caabb6

Browse files
committed
docs: add tree demo
1 parent 5cf57f4 commit 3caabb6

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

components/tree/demo/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Line from './line';
88
import Search from './search';
99
import Directory from './directory';
1010
import ReplaceFields from './replaceFields';
11+
import SwitcherIcon from './switcher-icon';
1112
1213
import CN from '../index.zh-CN.md';
1314
import US from '../index.en-US.md';
@@ -45,6 +46,7 @@ export default {
4546
<Line />
4647
<Search />
4748
<Directory />
49+
<SwitcherIcon />
4850
<api>
4951
<template slot="cn">
5052
<CN />

components/tree/demo/switcher-icon.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<cn>
2+
#### 自定义展开/折叠图标
3+
自定义展开/折叠图标。
4+
</cn>
5+
6+
<us>
7+
#### Customize collapse/expand icon
8+
customize collapse/expand icon of tree node
9+
</us>
10+
11+
```tpl
12+
<template>
13+
<a-tree
14+
showLine
15+
:defaultExpandedKeys="['0-0-0']"
16+
@select="onSelect"
17+
>
18+
<a-icon slot="switcherIcon" type="down" />
19+
<a-tree-node title="parent 1" key="0-0">
20+
<a-tree-node title="parent 1-0" key="0-0-0">
21+
<a-tree-node title="leaf" key="0-0-0-0" />
22+
<a-tree-node title="leaf" key="0-0-0-1" />
23+
<a-tree-node title="leaf" key="0-0-0-2" />
24+
</a-tree-node>
25+
<a-tree-node title="parent 1-1" key="0-0-1">
26+
<a-tree-node title="leaf" key="0-0-1-0" />
27+
</a-tree-node>
28+
<a-tree-node title="parent 1-2" key="0-0-2">
29+
<a-tree-node title="leaf" key="0-0-2-0" />
30+
<a-tree-node title="leaf" key="0-0-2-1" />
31+
</a-tree-node>
32+
</a-tree-node>
33+
</a-tree>
34+
</template>
35+
<script>
36+
export default {
37+
methods: {
38+
onSelect(selectedKeys, info) {
39+
console.log('selected', selectedKeys, info);
40+
},
41+
},
42+
};
43+
</script>
44+
```

0 commit comments

Comments
 (0)