Building an E-Commerce Store - Browsing Products Chapter 10
sidebar: ProductFiltering
},
props: {
default: true,
sidebar: true
}
}
You should now have the Home route, which includes the CategoryPage
and ListCategories components, and the Category route, which includes the
ProductFiltering component instead.
From the CategoryPage component, copy the props and computed objects - as we are
going to be utilizing a lot of the existing code. Rename the category computed function to
filters. Remove both the return and the componentNotFound if statement. Your
component should now look like the following:
const ProductFiltering = {
name: 'ProductFiltering',
template: `<div>
<list-categories />
</div>`,
components: {
ListCategories
},
props: {
slug: String
},
computed: {
...Vuex.mapGetters([
'categoriesExist',
'categoryProducts'
]),
filters() {
if(this.categoriesExist) {
let category = this.categoryProducts(this.slug);
}
}
}
}