fix: filter products at top level
This commit is contained in:
parent
50b8c654ae
commit
3a94405124
3 changed files with 15 additions and 26 deletions
|
|
@ -111,7 +111,7 @@ const market = async () => {
|
|||
},
|
||||
computed: {
|
||||
filterProducts() {
|
||||
let products = this.products
|
||||
let products = this.products.filter(p => this.hasCategory(p.categories))
|
||||
if (this.activeStall) {
|
||||
products = products.filter(p => p.stall_id == this.activeStall)
|
||||
}
|
||||
|
|
@ -891,7 +891,15 @@ const market = async () => {
|
|||
} else {
|
||||
this.filterCategories.splice(index, 1)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
hasCategory(categories = []) {
|
||||
if (!this.filterCategories?.length) return true
|
||||
for (const cat of categories) {
|
||||
if (this.filterCategories.indexOf(cat) !== -1) return true
|
||||
}
|
||||
return false
|
||||
},
|
||||
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue