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

        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'
                })
            })
        }

 

posted @ 2023-12-01 11:05  勇敢的菜花  阅读(61)  评论(0编辑  收藏  举报