const handleSave = async () => { let arr: any = [] const res = await form.validateFields() console.log(res) arr = myFunc(res) console.log(arr, "arrarrarrarr") arr = concatValue(arr, sizeList, "colorName") console.log(arr, "arrarrarrarr") const res1 = await formAll.validateFields() if (sizeItems.length === 0) { message.error("请新增至少一条尺码") return false } myContact(sizeItems, res1, "rate") arr = concatTarget(arr, sizeItems) arr = dataRuduce(arr) console.log(arr, "arrarrarrarrarr") const res2 = await formRoom.validateFields() }
利用async和await控制代码按照顺序执行