element table组件懒加载

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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

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

  

 

1
2
3
4
// 方法
 loadMore () {
      this.page++
},

  

  

posted @   惠鹏曦  阅读(5811)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示