Categories List
Documentation: Categories List Component
Overview
1.
2.
Model Documentation
model
object to control its behavior and appearance. Here's a breakdown of the properties used in the model
:Model Structure
model
object should have the following properties:String
A unique identifier for the component. This is used for the component’s
id
attribute and can be used for styling or targeting the component with JavaScript.String
Optional CSS class(es) for the outer container. This allows for additional styling.
String
Optional header text to be displayed at the top of the list. This text is rendered as an
<h2>
element.Number
Controls the alignment of the header text. Possible values are:
1
: Left alignment (justify-content-start
)2
: Center alignment (justify-content-center
)3
: Right alignment (justify-content-end
)Array
An array of category IDs used to fetch category data.
Example Model
model
object:{
"id": "categories-list-1",
"cssClass": "custom-categories-list",
"header": "Featured Categories",
"alignment": 2,
"categoryIds": ["cat1", "cat2", "cat3"]
}
Component Structure
1.
2.
HTML Template
CategoriesList
data:
JavaScript
Explanation
1.
model
object as a prop, containing configuration and data used for rendering.2.
3.
4.
categoryTitle
, categories
, or navigations
as needed.Steps to Create Your Own Categories List Component
1.
Vue.component()
or app.component()
to register the component.2.
v-if
, v-for
, :class
, etc.) for dynamic rendering.3.
props
for the model
object.mounted()
lifecycle hook to