添加json屬性並賦值或修改json屬性(ztree樹形結構)
阿新 • • 發佈:2017-11-16
items length [] box poi 修改 item sub amp
var data=[ {accounts :[], attrs : {maxmailboxsize: "-1", maxusers: "-1"}, fullpath : "",id :"og59fdbc30578", modifytime : "", name:"123", poid : "", children : [] }, {accounts :[], attrs : {maxmailboxsize: "-1", maxusers: "-1"}, fullpath : "",id :"og59fdbc30578", modifytime :"", name:"開發部", poid : "", children : [{ accounts :[], attrs : {maxmailboxsize: "開發部1", maxusers: "-1"}, fullpath : "",id :"og59fdbc30578", modifytime : "", name:"開發部1", poid : "", children : [{accounts :[], attrs : {maxmailboxsize:"開發部11", maxusers: "-1"}, fullpath : "",id :"og59fdbc30578", modifytime : "", name:"開發部11", poid : "", children : [{ accounts :[], attrs : {maxmailboxsize: "-1", maxusers: "-1"}, fullpath :"",id :"og59fdbc30578", modifytime : "", name:"開發部111", poid : "", children : [{ accounts :[], attrs : {maxmailboxsize: "-1", maxusers: "-1"}, fullpath : "",id :"og59fdbc30578", modifytime : "", name:"開發部1111", poid : "", children : [{ accounts :[], attrs : {maxmailboxsize: "-1", maxusers: "-1"}, fullpath : "",id :"og59fdbc30578", modifytime : "", name:"開發部1111", poid : "", children : [{ accounts :[], attrs : {maxmailboxsize: "-1", maxusers: "-1"}, fullpath : "",id :"og59fdbc30578", modifytime : "", name:"開發部111111", poid : "", children : [] }] }] }] }] }] }] } ]; if(data != "" && data.length>0){ for(var i=0;i<data.length;i++){ console.log(data[i]); var s = data[i]; s["subditems"]=s.children; console.log(s); } } console.log(data);
添加json屬性並賦值或修改json屬性(ztree樹形結構)