vue实现前端表格多条件搜索
目录
vue实现前端表格多条件搜索
前端页面:

请求后台

后台数据

搜索按钮的方法

// 搜索
sousuo() {
this.userxinxi = this.restaurants
if (!(this.userid === '')) {
this.userxinxi = this.userxinxi.filter(data => {
if (data.id === this.userid) {
return true
}
})
}
if (!(this.username === '')) {
this.userxinxi = this.userxinxi.filter(data => {
if (data.username === this.username) {
return true
}
})
}
if (!(this.leibie === '')) {
this.userxinxi = this.userxinxi.filter(data => {
if (data.roles === this.leibie) {
return true
}
})
}
if (this.leibie === '' && this.userid === '' && this.username === '') {
this.userxinxi = this.restaurants
}
},