zoukankan      html  css  js  c++  java
  • vue 滚动加载数据

    核心方法:

     handleScroll: function () {
          var scrollTop =
            document.documentElement.scrollTop || document.body.scrollTop;
          var windowHeitht =
            document.documentElement.clientHeight || document.body.clientHeight;
          var scrollHeight =
            document.documentElement.scrollHeight || document.body.scrollHeight;
          if (scrollTop + windowHeitht >= scrollHeight - 2000) {
            if (this.scroll) {
              this.GetSpecialData();
            }
          }
        },
        GetSpecialData() {
          this.scroll = false;
          this.page.pageIndex++;
          this.load(this.page, this.query);
        },

    监听:

     mounted() {
        window.addEventListener("scroll", this.handleScroll);
      },
      destroyed() {
        window.removeEventListener("scroll", this.handleScroll, false);
      },
    为了明天能幸福,今天付出再多也不后悔。
  • 相关阅读:
    登录认证
    json
    关于优化
    网站资源
    设计模式
    Python
    查兰IP
    Linux命令
    centos7.0KVM虚拟化
    Shell数组
  • 原文地址:https://www.cnblogs.com/zlp520/p/15129085.html
Copyright © 2011-2022 走看看