zoukankan      html  css  js  c++  java
  • 分页请求下一条数据

    分页获拉取下一页数据

    function loadNextPageData(self, callball) {
      if (window.IntersectionObserver) {
        const options = {
          root: null,
          threshold: 0
        }
        const handleIntersect = (entries, observer) => {
          entries.forEach(async (entry) => {
            if (entry.isIntersecting || entry.intersectionRatio || entry.isIntersecting === undefined) {
              self.requesting = true
              if (self.requesting && self.count > 0) {
                self.requesting = false
                self.pageIndex += 1
                await callball(self.pageIndex)
                self.requesting = true
              } else {
                self.isLoading = true // 不显示
                self.noMore = true // 加载到最后一页无数据了
                observer.unobserve(entry.target)
              }
            }
          })
        }
        const observer = new IntersectionObserver(handleIntersect, options)
        if (!self.isLoading) observer.observe(self.$refs.loading.$el.firstChild)
      }
    }
  • 相关阅读:
    python 全栈基础作业题
    计算机基础之二:操作系统的发展史
    计算机基础系列之一:计算机硬件概述
    饼图
    折线图
    win_diy_monkey demo
    csv,Excel
    uiautomator2
    win ui自动化测试
    html
  • 原文地址:https://www.cnblogs.com/restart77/p/12336361.html
Copyright © 2011-2022 走看看