1. // 递归
formatTree(data) {
for (let i in data) {
// if (data[i].children === null) continue
if (data[i].children.length === 0) {
// 证明是最后一级,取值
this.dynamicTags.push(data[i].label)
} else {
// 证明不是最后一级,继续找
this.formatTree(data[i].children)
}
}
}
2. this.formatTree(val)