使用vue实现数据搜索功能,因为功能简单就不过多介绍了
<input type="text" placeholder="请输入关键词" v-model="search"/>
search:'',
videoList:[
{
name:'文件夹_1',
id:1,
file:[
{
active: false,
id: 1,
name: " 测试视频",
url:"hs/63902e5da667f.mp4",
},
]
},
{
active: false,
id: 3,
name: " 测试视频",
url:"http2e5da667f.mp4",
},
],
computed:{
searchList(){
if(this.search == ''){
return this.search
}else{
return this.videoList.filter(item=>{
return item.name.includes(this.search)
})
}
}
},