let list: any[] = []
this.state.selectedRowKeys.forEach((it: number) => {
list.push(
new Promise((resolve) => {
resolve(update({ id: it, status: 1 }))
})
)
})
// promise.all——因为数据请求具有随机性,所以使用 promise.all 可以保证批量更新完毕后再执行后面的代码
Promise.all(list).then((res) => {
console.log(res, 'res')
this.getData()
})
}