码迷,mamicode.com
首页 > 其他好文 > 详细

iview表格搜索功能

时间:2018-09-30 16:43:17      阅读:1447      评论:0      收藏:0      [点我收藏+]

标签:else   div   ++   let   this   nbsp   template   []   route   

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()
},

iview表格搜索功能

标签:else   div   ++   let   this   nbsp   template   []   route   

原文地址:https://www.cnblogs.com/limengyao/p/9729624.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!