
export default {
    // 把一个树状数据变为一维数组，并带有level
    flatten (data) {
        return data.reduce((arr, {id, name, children = []}) =>
            arr.concat([{id, name}], this.flatten(children)), [])
    }
}


