300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > vue实现模糊查询搜索

vue实现模糊查询搜索

时间:2020-08-23 14:32:45

相关推荐

vue实现模糊查询搜索

<bz-inputsize="small"class="search"v-model="value"placeholder="请输入关键字搜索"><template v-slot:left-icon><img class="icon" src="../../assets/img/综合查询/搜索.png" alt="" /></template></bz-input>//存储初始值localStorage.setItem("fydataInfo", JSON.stringify(this.dataInfo));watch: {// 模糊查询搜索value(newVal, oldVal) {if (this.timer) {clearTimeout(this.timer);}console.log(newVal, oldVal);if (newVal == "") {// 取值let add = localStorage.getItem("fydataInfo");console.log(JSON.parse(add));if (newVal == "") {this.dataInfo = JSON.parse(add);}} else {// 用于模糊查询this.timer = setTimeout(() => {const result = [];this.dataInfo.filter(item =>{if(item.name.indexOf(newVal) !== -1){result.push(item)}})console.log(result);this.dataInfo = result;}, 100);}},},

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。