What is the difference between asyncData in nuxt and data in vue?

No response to interface requests in asyncData

clipboard.png

api.jsaxiosstatic:

clipboard.png

clipboard.png

I put the request in mounted so that I can request it successfully

Mar.11,2021

has been using nuxt, the out-of-the-box SSR framework, for some time recently.

officially, asyncData is data that is called during the creation of a vue page to assign values to page variables.

The difference between

and data is that this part of the data is loaded into the page during SSR rendering and can be retrieved by SEO.

the data you get in mounted needs to be saved in data before rendering, so if your data is loaded in mounted, SEO will not be able to retrieve it.

Menu