iview表格搜索功能


template中:
<Input v-model.trim="tagData.name" :search="true" enter-button size="small" class="fr mar-r16 wd-20P" @on-search="() => this.getUserFn(tagData.name)"/>
 
methods中:
getUserFn (item) {
  // console.log(item)
  let name = this.$route.params.name
  this.$api.ceph(this.zone).getUser(name)
    .then(res => {
      console.log(res)
      let array = []
      if (item == ('' || null)) {
        this.tagData = res.data.data
      }else {
        let arr = res.data.data
        for (let i=0; i<arr.length; i++) {
        // console.log(arr[i].name)
        if (arr[i].name.indexOf(item)>-1) {
          // console.log(arr[i])
          array.push(arr[i])
        }
     }
     this.tagData = array
    }
  })
  .catch()
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM