Home
Wiki
Home
Wiki
  1. Components
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
  1. Components

Brand List

Documentation: Brand List Component#

The Brand List Component is a Vue.js component that displays a list of brand items, each represented by an image or name. The component is designed to be highly customizable through the model object, which controls the appearance and functionality.

Overview#

The Brand List Component presents a grid of brand items. Each item can either display an image or a textual representation of the brand's name. The component adapts to different layouts based on the provided configuration.

Model Documentation#

The Brand List Component uses a model object to configure its behavior and appearance. Here's a breakdown of the properties used in the model:
Model Structure#
The model object should have the following properties:
id: 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.
cssClass: String
Optional CSS class(es) for the outer container. This allows for additional styling.
header: String
Optional header text to be displayed at the top of the list. This text is rendered as an <h2> element.
alignment: 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)
brandIds: Array
An array of brand IDs used to fetch brand data.
Example Model#
Here is an example of the model object:
{
  "id": "brands-list-1",
  "cssClass": "custom-brand-list",
  "header": "Our Brands",
  "alignment": 2,
  "brandIds": ["brand1", "brand2", "brand3", "brand4"]
}

Component Structure#

The component is implemented with the following Vue.js features:
1.
HTML Template: Defines the structure and appearance of the brands list.
2.
JavaScript Logic: Manages data retrieval and utility functions.

HTML Template#

The HTML template is responsible for rendering the list of brands. It uses Vue.js directives to dynamically generate the list based on the BrandList data:

JavaScript#

The JavaScript portion of the component handles data initialization and utility functions:

Explanation#

1.
Props:
model: The component receives a model object as a prop, which contains configuration and data used for rendering.
2.
Data:
Data: Stores the model object.
BrandList: Initializes as an empty array and will be populated with brand data fetched from a service.
3.
Methods:
getAlignmentClass(alignment): Returns a CSS class based on the alignment value to control the alignment of the header.
4.
Mounted Lifecycle Hook:
mounted(): Fetches brand data using the _findBrandsByIds method and updates the BrandList with the fetched data.

Steps to Create Your Own Brands List Component#

1.
Define the Vue Component:
Use Vue.component() or app.component() to register the component.
2.
Create the Template:
Structure the HTML to include a header and a list of brands.
Use Vue.js directives (v-if, v-for, :class, etc.) for dynamic rendering.
3.
Implement JavaScript Logic:
Define props for the model object.
Initialize data and implement methods for functionality.
Use the mounted() lifecycle hook to fetch and set brand data.
4.
Customize Styling and Layout:
Adjust CSS classes and styles according to your design requirements.
5.
Test and Debug:
Ensure the component functions correctly in different scenarios and screen sizes.
Debug any issues related to data binding or rendering.
6.
Deploy the Component:
Integrate the component into your Vue.js application and deploy it as part of your project.
This documentation provides a comprehensive guide to the Brands List Component, including how to use and customize it according to your needs.
Modified at 2024-08-27 07:58:19
Previous
Blog List
Next
Brands Carousel
Built with