C# private void DeleteByID(string id) { for (var i = 0; i < ZDemoData.DataList.Count; i++) { if (ZDemoData.DataList[i].id == id || ZDemoData.DataList[i].pId == id) { var tx = ZDemoData.DataList[i].id; ZDemoData.DataList.RemoveAt(i); i = i - 1; DeleteByID(tx); } } }
JS //删除 function DeleteByID(id,nodes) { for (var i = 0; i < nodes.length; i++) { if (nodes[i].id == id || nodes[i].pId == id) { var tx=nodes[i].id; nodes.splice(i, 1); i = i - 1; DeleteByID(tx, nodes) } } }