for example if i click on jackets i get the products under jackets, how do i not show any product if i click on both jacket and xl, cause the json object m getting doesn't have "xl" in sizes which has jacket in it
this is my template
<div id="app">
<div class="pt-2 font-weight-bold ">
<input
v-model="checked"
type="checkbox"
id=""
value="jackets"
>
<input
v-model="checked"
type="checkbox"
id=""
value="xl"
>
</div>
</div>
this is my script
new Vue({
el: '#app',
data: {
product: {
{
"_id": "6316f215fd9c107baa1bc160",
"title": "Denim Jacket",
"type": "Jackets",
"brand": "next",
"size": "l",
"description": "clean suede jacket ",
"price": 84,
"stockQuantity": 1,
},
{
"_id": "631a90d3fd9c107baa1bc716",
"title": "Printed sweat-shirt",
"type": "dresses",
"brand": "nike",
"size": "xl",
"price": 200,
"stockQuantity": 3,
"__v": 0,
"id": "631a90d3fd9c107baa1bc716"
}
}
}
computed: {
...mapGetters(["isLoggedIn"]),
computedProducts() {
let tempRecipes = this.products;
if (this.checked.length === 0) {
return tempRecipes;
} else {
return tempRecipes.filter(
product =>
this.checked.indexOf(product.type) !== -1 ||
this.checked.indexOf(product.brand) !== -1 ||
this.checked.indexOf(product.size) !== -1
);
}
}
},
})
please how can i go about this