我已经遍历出来子节点和父节点了,但是形成的json数据他们是没有关联的怎么让他们关联起来啊
我现在形成的是这样的[{"id":"1","text":"父节点","pid":"0","subNodeList":[]},{"id":"2","text":"子节点1"...
我现在形成的是这样的
[{"id":"1","text":"父节点","pid":"0","subNodeList":[]},{"id":"2","text":"子节点1","pid":"1","subNodeList":[]},{"id":"3","text":"子节点2","pid":"1","subNodeList":[]},{"id":"6","text":"子节点3","pid":"1","subNodeList":[]},{"id":"4","text":"孙子1","pid":"2","subNodeList":[]},{"id":"5","text":"孙子2","pid":"2","subNodeList":[]},{"id":"7","text":"孙子san","pid":"3","subNodeList":[]}] 我先要的是将子节点装进subNodeList中 展开
[{"id":"1","text":"父节点","pid":"0","subNodeList":[]},{"id":"2","text":"子节点1","pid":"1","subNodeList":[]},{"id":"3","text":"子节点2","pid":"1","subNodeList":[]},{"id":"6","text":"子节点3","pid":"1","subNodeList":[]},{"id":"4","text":"孙子1","pid":"2","subNodeList":[]},{"id":"5","text":"孙子2","pid":"2","subNodeList":[]},{"id":"7","text":"孙子san","pid":"3","subNodeList":[]}] 我先要的是将子节点装进subNodeList中 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询