vardataObject={"1":{"name":"第一级1","type":"第一级2","describe":"第一级3","testNum":"第一级4","1-1":{"name":"第二级5","type":"第二级6","describe":"第二级7","testNum":"第二级8","1-1-1":{"name":"第三级9","type":"第三级q","describe":"第三级w","testNum":"第三级e"},"1-1-2":{"name":"第三级r","type":"第三级ty","describe":"第三级y","testNum":"第三级y"}}},"2":{"name":"第一级6","type":"第一级d","describe":"第一级f","testNum":"第一级g"}};将里面的1-1,1-1-1,1-2之类的值修改成对应的name字段里面的值,需要替换成下面这种的:vardataObject={"第一级1":{"name":"第一级1","type":"第一级2","describe":"第一级3","testNum":"第一级4","第二级5":{"name":"第二级5","type":"第二级6","describe":"第二级7","testNum":"第二级8","第三级9":{"name":"第三级9","type":"第三级q","describe":"第三级w","testNum":"第三级e"},"第三级r":{"name":"第三级r","type":"第三级ty","describe":"第三级y","testNum":"第三级y"}}},"第一级6":{"name":"第一级6","type":"第一级d","describe":"第一级f","testNum":"第一级g"}};树形结构总共有三层,可能会有很多数据,规律就是这样,试了好久的递归,找不出解答方法,烦死了
FFIVE
尚方宝剑之说
相关分类