js数组删除(splice)

    "data":[
        Object{...},
        Object{...}
    ]

展开:

{
    "data":[
        {
            "id":"286",
            "name":"8000",
            "ipAdress":"[email protected]",
            "groupId":"022ef5df-4bd4-403f-b265-073300cd5a7a",
            "mcuName":"北京1",
            "type":"h323",
            "pollStatus":"0",
            "createTime":"2019-06-25T11:07:57.000+0800"
        },
        {
            "id":"287",
            "name":"8001",
            "ipAdress":"[email protected]",
            "groupId":"022ef5df-4bd4-403f-b265-073300cd5a7a",
            "mcuName":"北京2",
            "type":"h323",
            "pollStatus":"0",
            "createTime":"2019-06-25T14:23:36.000+0800"
        }
    ]
}

删除:

var id=286

for (var model in data) { 
   if (id === data[model]['id']) {
       data.splice(model, 1)
   }
}

 

你可能感兴趣的:(前端,js)