zoukankan      html  css  js  c++  java
  • 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=" 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>
    

      

  • 相关阅读:
    刷题柱 -- 暂封
    模板重搭建計劃
    思路与好题记录与小技巧
    错误记录
    随便记点东西……
    图床
    杂碎的小技巧
    hnsdfz -- 6.21 -- day7
    hsdf -- 6.21 -- day6
    hnsdfz -- 6.20 -- day5
  • 原文地址:https://www.cnblogs.com/SunshineKimi/p/14927263.html
Copyright © 2011-2022 走看看