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>
    

      

  • 相关阅读:
    XAML实例教程系列
    XAML实例教程系列
    XAML实例教程系列
    正则表达式 修改流程 过程是崎岖的
    Codeforces Round #379 (Div. 2) 解题报告
    (DFS)codevs1004-四子连棋
    (BFS)poj2935-Basic Wall Maze
    (BFS)poj1465-Multiple
    (BFS)uva2554-Snakes & Ladders
    (BFS)hdoj2377-Bus Pass
  • 原文地址:https://www.cnblogs.com/SunshineKimi/p/14927263.html
Copyright © 2011-2022 走看看