其他分享
首页 > 其他分享> > element table组件懒加载

element table组件懒加载

作者:互联网

directives : {
    loadmore : {
      bind(el, binding) {
        const selectWrap = el.querySelector('.el-table__body-wrapper')
        selectWrap.addEventListener('scroll', function() {
          let sign = 0
          const scrollDistance = this.scrollHeight - this.scrollTop - this.clientHeight
          if (scrollDistance <= sign) {
            binding.value()
          }
        })
      }
    }
  },

// 自定义指令后,在el-table标签下使用v-loadmore

 <el-table v-loadmore="loadMore"  >
</el-table>

  

 

// 方法
 loadMore () {
      this.page++
},

  

  

标签:el,const,element,scrollDistance,table,loadmore,selectWrap,加载
来源: https://www.cnblogs.com/hpx2020/p/11889481.html