<ul>
<li v-for="(item,i) in items" :key="i">{{item.name}}</li>
</ul>
data(){
return{
searchValue:"",
allDefectList:[],
}
},
computed: {
//过滤方法
items: function() {
if(this.searchValue!= ''){
return this.allDefectList.filter(i=>{return i.name.indexOf(this.searchValue) != -1}) ;
}else{
return this.allDefectList;
}
}
},