使用Promise.all实现,代码:

        const getResultList = async () => {
            try {
                const [res1, res2] = await Promise.all([
                    dictionaryListAjax({ type: 'type1' }) as any,
                    dictionaryListAjax({ type: 'type2' }) as any,
                ]);
                return [res1, res2];
            } catch (error) {
                console.error(error);
            }
        };

        let value1 = [];
        let value2 = [];
        getResultList().then(([res1, res2]: any) => {
            if (res1 && res1.length) {
                const result = res1.map((val: any) => {
                    return val.name;
                });
                value1.value = result;
            }
            if (res2 && res2.length) {
                const result = res2.map((val: any) => {
                    return val.name;
                });
                value2.value = result;
            }
        });

我的一个道姑朋友
80 声望4 粉丝

星光不问赶路人,岁月不负有心人。