PeachScript / vue-infinite-loading

An infinite scroll plugin for Vue.js.
https://peachscript.github.io/vue-infinite-loading/
MIT License
2.66k stars 366 forks source link

Access to isFirstLoad inside v-slot:spinner via scoped-slot #287

Open gavrashenko opened 4 years ago

gavrashenko commented 4 years ago

It would be nice to have access to isFirstLoad variable inside <template v-slot:spinner>... via scoped-slot. Because sometimes it's normal to show skeleton loader or any other loader as initial loader ( just for the first loading ), and change it to other loader after it, for example:

     <InfiniteLoading
        @infinite="infinite"
        spinner="spiral"
      >
        <template v-slot:spinner="{ isFirstLoad }">
          <SkeletonLoader v-if="isFirstLoad"></SkeletonLoader>
          <span v-else>Loading more messages...</span>
        </template>
      </InfiniteLoading>

Pull request: https://github.com/PeachScript/vue-infinite-loading/pull/288