vue+elementUI input框之过滤显示

 效果图如下:

vue+elementUI input框之过滤显示_第1张图片


  

methods:{
  querySearch(queryString,cb){
    let arr = [
      {name:'a',value:'he is a gril'},
      {name:'b',value:'good name'},
      {name:'c',value:'how boy'},
    ];
    let results = queryString ? arr.filter((currentValue,index,arr) => {
      console.log(currentValue);//item的每一项
      console.log(arr);//arr数组
      return (currentValue.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);//满足条件的返回
    },this):arr;
    cb(results)
  },
}

 

 

 

你可能感兴趣的:(VUE)