Skip to content

Commit 0a368e7

Browse files
github-actions[bot]muronggwebfansplz
authored
feat(question): tree component
* feat(question): add Tree Component Co-authored-by: 木荣 <[email protected]> Co-authored-by: webfansplz <[email protected]>
1 parent 0a47a17 commit 0a368e7

File tree

6 files changed

+85
-0
lines changed

6 files changed

+85
-0
lines changed

questions/208-tree-component/App.vue

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<script setup lang="ts">
2+
import { ref } from "vue"
3+
import TreeComponent from "./TreeComponent.vue"
4+
const treeData = ref([{
5+
key: '1',
6+
title: 'Parent 1',
7+
children: [{
8+
key: '1-1',
9+
title: 'child 1',
10+
}, {
11+
key: '1-2',
12+
title: 'child 2',
13+
children: [{
14+
key: '1-2-1',
15+
title: 'grandchild 1',
16+
}, {
17+
key: '1-2-2',
18+
title: 'grandchild 2',
19+
},]
20+
},]
21+
}, {
22+
key: '2',
23+
title: 'Parent 2',
24+
children: [{
25+
key: '2-1',
26+
title: 'child 1',
27+
children: [{
28+
key: '2-1-1',
29+
title: 'grandchild 1',
30+
}, {
31+
key: '2-1-2',
32+
title: 'grandchild 2',
33+
},]
34+
}, {
35+
key: '2-2',
36+
title: 'child 2',
37+
},]
38+
}])
39+
</script>
40+
41+
<template>
42+
<TreeComponent :data="treeData" />
43+
</template>
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!--info-header-start-->
2+
<!--info-header-end-->
3+
4+
For this challenge, you need to imlement a tree component,let’s go.
5+
6+
<!--info-footer-start-->
7+
<!--info-footer-end-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--info-header-start-->
2+
<!--info-header-end-->
3+
4+
5+
在这个挑战中,你需要实现一个树组件,让我们开始吧。
6+
7+
8+
<!--info-footer-start-->
9+
<!--info-footer-end-->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script setup lang="ts">
2+
interface TreeData {
3+
key: string
4+
title: string
5+
children: TreeData[]
6+
}
7+
defineProps<{data: TreeData}>()
8+
</script>
9+
10+
<template>
11+
<!-- do something.... -->
12+
</template>

questions/208-tree-component/info.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
difficulty: hard
2+
title: Tree Component
3+
tags: Components
4+
author:
5+
github: murongg
6+
name: 木荣
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
difficulty: hard
2+
title: 树组件
3+
tags: Components
4+
author:
5+
github: murongg
6+
name: 木荣
7+

0 commit comments

Comments
 (0)