Antd Select数据懒加载

2020-08-19  本文已影响0人  J_SQ
       <a-select
            placeholder="请选择"
            v-model=""
            style="width: 100%"
            @popupScroll="scrollMore"//滚动触发的方法
            @change="selectedSet"
          >
          <a-select-option></a-select-option>
       </a-select>
   scrollMore(e) {
      const { target } = e
      var total = target.scrollTop + target.offsetHeight
      var scrollHeight = target.scrollHeight
      console.log('total:' + total)
      console.log('scrollHeight:' + scrollHeight)
      console.log('-------重要的是下面的判断条件↓--------------------------------')
      #this.scrollPage是当前页 this.totalCount是总条数
      if (total >= scrollHeight - 1 && total < scrollHeight + 1 && this.scrollPage < 
      this.totalCount ) {
          this.scrollPage = this.scrollPage + 1
          this.getCompanyList() // 调用api方法
        }
    }
  getCompanyList(value) {}
上一篇下一篇

猜你喜欢

热点阅读