Method: get recursively
The following is a screenshot when I wrote the project
getChildrenIndex(currentColumns) {
console.log('currentColumns', currentColumns)
for (var i = 0; i < currentColumns.length; i++) {
let item = currentColumns[i]
if (item.children) {
this.getChildrenIndex(item.children)
} else {
this.curColumnList.push(item.dataIndex)
}
}
},
currentColumns is the tree structure header data
Idea: Clear the array before each recursion, and then push the dataIndex of each recursive item inside, dataIndex is the name of the header field