资源: https ://codesandbox.io/s/dropdown-u7r6q
总结:数据
通过函数传递getData()
给数据变量,处理将在其中handleData()
问题: 如何以这样一棵树的形式显示这些值
<div>
<b>Id: 1</b>
<span>name: name1</span>
<div>
<b>Id: 1.1</b>
<span>name: name1.1</span>
</div>
</div>
<div>
<b>Id: 2</b>
<span>name: name2</span>
</div>
<div>
<b>Id: 3</b>
<span>name: name3</span>
<div>
<b>Id: 3.1</b>
<span>name: name3.1</span>
<div>
<b>Id: 3.1.1</b>
<span>name: name3.1.1</span>
</div>
</div>
<div>
<b>Id: 3.2</b>
<span>name: name3.2</span>
</div>
</div>