如何在element-ui table 取到对应的ID的最后一个对象

来回切换3个状态值如何得到对应ID的最后一个对象

var is_push = () => {
for (var i = 0; i < this.form.FaultDevices.length; i++) {
  if (this.form.FaultDevices[i].ID === row.ID) {
    return i;
    }
   }
  return -1;
}
var index = is_push()
  if (value !== -1) {
    var data = {
      FGuid: "",
      ID: row.ID,
      DeviceId: row.DeviceId,
      HandleState: value
    }
  if (index !== -1) {
  this.form.FaultDevices[index] = data
    } else {
      this.form.FaultDevices.push(data)
    }
    } else {
    if (index !== -1) {
      this.form.FaultDevices.splice(index, 1);
    }
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2021-11-22
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
  • 2021-11-23
  • 2021-09-30
  • 2022-12-23
相关资源
相似解决方案