vue 懒加载scrollevent

    scrollevent(e){
      let heights=e.target.scrollHeight, top = e.target.scrollTop, clientHeight=e.target.clientHeight
      let distance=heights-top-clientHeight
      
      if (distance <10){
        if (this.page_param.page <Math.ceil(this.totals/10)){
          this.page_param.page=this.page_param.page+1
          this.$axios({
            url:"demo-service/api/testcase",
            method:"get",
            params:{...this.page_param}
          }
          ).then(res=>{
            let newnames=[]
            let result= Array.from(res.data.data)
              //console.log(this.page_param.page)
             
              for (let item of result){
                  newnames.push({"id":item.id,"name":item.case_name})
                  // this.names_list=  Array.from(new Set( this.names_list.concat(newnames)))  
                  for (let it of newnames){
                    if (!this.names_list.includes(it)){
                      this.names_list.push(it)
                    }
              }
              // this.names_list=Object.assign([],this.names_list,newnames)
              this.OPTIONS=this.names_list
              
              
           
            }

          }).catch(err=>{
            console.log(err)
          })

        }
        
      }
    },

  

      <a-select
      mode="multiple"
      placeholder="根据名称模糊查询"
      :value="selectedItems"
      style="width: 60%; margin-top:10px"
      @change="handleChange"
      @popupScroll="e=>scrollevent(e)"
      :maxTagTextLength="tagmaxlength"
    >
      <a-select-option v-for="item in filteredOptions" :key="item.id" :value="item.name">
        {{ item.name}}
      </a-select-option>
    </a-select>

  

vue 懒加载scrollevent

上一篇:离散数学(数论基础)


下一篇:基于git tag快速修复