vue axios all 接口全部成功之后进行其它操作

发布时间 2023-12-01 11:09:40作者: 勇敢的菜花
        setSelf() {
            const arr: any = []
            list?.forEach((item) => {
                const obj = {
                    id: 1
                }
                arr.push(obj)
            })
            arr.push()
            return this.api?.set1Type(arr) // 调接口
        },
        setOut() {
            const obj = {
                id:1
            }
            return this.api?.set2Type([obj]) // 调接口
        },
        onSubmit() {
            Promise.all([this.setSelf(), this.setOut()]).then((res) => {
                ElMessage({
                    type: 'success',
                    message: 'xxxxxxx'
                })
            })
        }