数据结构:
let address = [
{
label: "北京市",
children: []
},
{
label: "天津市",
children: []
},
{
label: "上海市",
children: []
},
{
label: "重庆市",
children: []
},
{
label: "河北省",
children: [
{
label: "石家庄市"
},
{
label: "唐山市"
},
{
label: "秦皇岛市"
},
{
label: "邯郸市"
},
{
label: "邢台市"
},
{
label: "保定市"
},
{
label: "张家口市"
},
{
label: "承德市"
},
{
label: "沧州市"
},
{
label: "廊坊市"
},
{
label: "衡水市"
}
]
},
]
vscode控制台打印结果:
浏览器运行打印结果: