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.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf12a4-46d9a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf12a4-46d9a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?