vue的模糊搜索
<template>
<div>
<div>
<input type="text" @input="handleInput" v-model=‘mytext‘>
<ul>
<li v-for="(data,index) in dataList">{{data}}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: ‘App‘,
data() {
return {
dataList:[‘dfef‘,‘geger‘,‘fefgw‘],
mytext:‘‘
}
},
methods: {
handleInput(){
console.log(this.mytext)
this.dataList = this.dataList.filter(item=>item.indexOf(this.mytext)>-1);
}
},
}
</script>
<style scoped lang="stylus" ref="stylesheet/stylus">
</style> 相关推荐
VLilyLUE 2020-06-11
StylusGalaxy 2020-04-29
前端工程师喻文强 2020-04-27
nicepainkiller 2020-02-23
xuelang 2020-01-16
Stylusnebula 2019-12-26
VLilyLUE 2019-12-08
didianmanong 2019-11-17
CaiKanXP 2019-11-10
StylusGalaxy 2019-11-09
flyingbird 2019-11-08
星辰的笔记 2016-04-25
Stylusnebula 2019-08-31
碎冰stylus融 2019-07-01
zhouyl0 2019-07-01
Stylusnebula 2019-07-01
crazestylus 2019-07-01
碎冰stylus融 2019-07-01
沉着前进 2019-06-30