function getIndexById(tree, indexID) {
    var stark = [];
    stark = stark.concat(tree);
    while (stark.length > 0) {
        var temp = stark.shift();
        if (temp.nodes) {
            stark = stark.concat(temp.nodes);
        }
        if (temp.indexID=== indexID) {
            return temp;
        }
    }
    return false;
}

 
posted on 2020-06-05 09:58  Qionghuihe  阅读(218)  评论(0编辑  收藏  举报