constdata=[{id:1,pid:0,text:1,children:[{id:2,pid:1,text:2,children:[{id:3,pid:2,text:3,children:[]}]}]}]//怎么查找id的父級的index索引id=3父級2所在數(shù)組index為0,在上父級的id1,所在數(shù)組的index0,直到最頂一層//輸入id3//返回[0,0,0]索引的數(shù)組
js,json樹查找父級路徑
阿晨1998
2019-05-12 12:51:44
