优质文章外链发布 5元/条 QQ:2970302840 广告(购买广告位、友情链接)
Camila Waz 发布于
2019-03-13 09:47:19

vue实现关键字模糊搜索

vue实现关键字模糊搜索

<input type="text" v-model="filterText2">
<template v-for="(item,index) in viewDictionArr">
  <li>{{item}}</li>
</template>
data(){
  return {
    filterText2:"",
    typeList:[],
  }
},
computed: {
	viewDictionArr(){
		let arr = [];
		for(var i = 0; i < this.typeList.length; i++) {
			if(this.filterText2 != '' && this.typeList[i].value.indexOf(this.filterText2) != -1){
				arr.push(this.typeList[i]);
			}else if(this.filterText2 == ''){
				arr.push(this.typeList[i]);
			}
		}
		return arr;
	}
},


当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2019-03-06/355.html
最后生成于 2020-05-09 11:21:44