asyncDataに限らないんだけど await Promise.all() 使うとキレイに書けるよねって話。 TypeScript x ES6 な感じ。 prefetch的な処理をキレイにかけるNuxtは最高だなと思います <script lang="ts"> import Vue from "vue"; import Component from "nuxt-class-component"; import Foo from "~/Foo"; import Bar from "~/Bar"; @Component({ async asyncData({ app, params }) { const id = _.get(params, "id"); // 2つのHTTPのレスポンスを受けてからページがレンダリングされる const [foo, bar] = await Promise.
![NuxtのasyncDataで複数のHTTPリクエストを扱う - Qiita](https://cdn-ak-scissors.b.st-hatena.com/image/square/a534e8a0bfea65e2c452679b41fa84e5766e6999/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-9f5428127621718a910c8b63951390ad.png%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTkxNiZoPTMzNiZ0eHQ9TnV4dCVFMyU4MSVBRWFzeW5jRGF0YSVFMyU4MSVBNyVFOCVBNCU4NyVFNiU5NSVCMCVFMyU4MSVBRUhUVFAlRTMlODMlQUElRTMlODIlQUYlRTMlODIlQTglRTMlODIlQjklRTMlODMlODglRTMlODIlOTIlRTYlODklQjElRTMlODElODYmdHh0LWNvbG9yPSUyMzIxMjEyMSZ0eHQtZm9udD1IaXJhZ2lubyUyMFNhbnMlMjBXNiZ0eHQtc2l6ZT01NiZ0eHQtY2xpcD1lbGxpcHNpcyZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZzPTQ4MDI3NmY3ZTBmNmZjZmExMzNiN2U2MmM1MTNiY2Y5%26mark-x%3D142%26mark-y%3D112%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTYxNiZ0eHQ9JTQwdGFreWFtJnR4dC1jb2xvcj0lMjMyMTIxMjEmdHh0LWZvbnQ9SGlyYWdpbm8lMjBTYW5zJTIwVzYmdHh0LXNpemU9MzYmdHh0LWFsaWduPWxlZnQlMkN0b3Amcz04NTY2Mzk0MjhhNDA3NTJmN2U5OGE5ZTA1N2U3MzAwNg%26blend-x%3D142%26blend-y%3D491%26blend-mode%3Dnormal%26s%3D06aff1b0239b14ffb01cd5538e2246a0)