Laravel.io
created() {
if (!this.category) {
this.$store.dispatch('categoryBySlug', this.$route.params['slug']);
}
if (!this.products) {
this.$store.dispatch('allProductsById', this.category.id);
}
//console.log(this.test);
console.log(this.category);
//console.log(this.products);
//console.log(this.category.title);
document.title = this.$router.currentRoute.meta.title;
},
methods: {
getPrice (name) {
let slider = this.$refs[name];
},
},
computed: {
test() {
return this.category.id;
},
category () {
return this.$store.getters.categoryBySlug(this.$route.params['slug']);
},
products () {
return this.$store.getters.allProductsById(/*this.category.id*/1);
},
filteredProducts: function() {
return this.products.filter(product => {
return product.title.toLowerCase().includes(this.filters.title.toLowerCase())
})
},
}