简体   繁体   中英

How to use infinite scroll in quasar to load more datas?


I am trying to load more data using quasar infinite scroll but i cannot load any more data infact it loads all the data once.... and i got

done() is not a function

Below is my method for infinite scroll

initDefaultData (done, index) {
  setTimeout (() => {
    if (this.datas) {
      db.collection('example').orderBy('created_at', 'desc').get().then(res => {
        if (res.size < 1) {
          this.noData = true
        } else {
          res.forEach((doc) => {
            this.datas.push({
              id: doc.id
            })
          })
        }
      })
      done()
    }
  }, 1000)
}

Here is where i use infinite scroll in template

<q-infinite-scroll @load="initDefaultData">
  <q-card v-for="(data, index) in datas" :key="index" class="q-mb-md q-mt-sm">
  </q-card>
</q-infinite-scroll>

Seems like you mixed parameters order: index goes before done

initDefaultData (index, done) {
...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM