1. @better-scroll/infinity
The ability to inject a infinity load for BetterScroll.
@better-scroll/infinity
Package: @better-scroll/infinity
Created by: ustbhuangyi
Last modified: Fri, 19 May 2023 10:27:06 GMT
Version: 2.5.1
Downloads: 10,268
Repository: https://github.com/ustbhuangyi/better-scroll

Install

npm install @better-scroll/infinity
yarn add @better-scroll/infinity

@better-scroll/infinity

中文文档

The ability to inject a infinity load for BetterScroll.

Usage

 import BScroll from '@better-scroll/core'
import InfinityScroll from '@better-scroll/infinity'
BScroll.use(InfinityScroll)

const bs = new BScroll('.wrapper', {
  infinity: {
    fetch(count) {
      // Fetch data that is larger than count, the function is asynchronous, and it needs to return a Promise.。
      // After you have successfully fetch the data, you need resolve an array of data (or resolve Promise).
      // Each element of the array is list data, which will be rendered when the render method executes。
      // If there is no data, you can resolve (false) to tell the infinite scroll list that there is no more data。
    }
    render(item, div) {
      // Rendering each element node, item is data, and div is a container for wrapping element nodes.
      // The function needs to return to the rendered DOM node.
    },
    createTombstone() {
      // Returns a tombstone DOM node.。
    }
  }
})

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code