Every time there is a change in the use of asyncData, in the nuxt framework, it needs to be re-npm run dev to display properly.

the nuxt framework uses asyncData, and needs to be re-npm run dev every time it changes. Otherwise, the error will be reported, and the code and error will be as follows

  asyncData({ params }) {
    let getNews = axios.getNews({ limit: 2 })
    let getBannerPic = axios.getBannerPic()
    let promise = Promise.all([getNews, getBannerPic])
    return promise.then(res => {
      let banners = []
      let bannersData = res[1].data.data
      for (let i = 0; i < bannersData.length; iPP) {
        banners.push(bannersData[i]["mobile_img"]["url"])
      }
      console.log(banners)
      return {
        news: res[0].data,
        banners: banners
      }
    })
  }

error
Cannot read property "length" of undefined 19:37:13

at promise.then.res (pages_index.js:790:39)
at process._tickCallback (internal/process/next_tick.js:68:7)

but it is normal to execute npm run dev every time. When you change something else, it will be compiled automatically, and an error will be reported here

.
Dec.07,2021
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-1b2e688-2bc2b.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-1b2e688-2bc2b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?