getParents(data, id) { // 根据value值匹配
for (const i in data) {
if (data[i].value === id) {
return [data[i].value]
}
if (data[i].children) {
const result = this.getParents(data[i].children, id)
if (result !== undefined) {
return result .concat(data[i].value)
}
}
}
}
网友评论