HomeWiki
HomeWiki
  1. Components
  • Back to home
  • 1. Themes
  • 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
  • Vs Code
    • Getting Started
  1. Components

Breadcrumb

Documentation: Breadcrumb Component#

The Breadcrumb Component is a Vue.js component designed to display breadcrumb navigation for a website. Breadcrumbs are a navigation aid that helps users understand their current location within the site’s hierarchy. This component is dynamic and adjusts its display based on the current path and context.

Overview#

The Breadcrumb Component uses a model object to configure its behavior and appearance. It generates breadcrumb navigation links dynamically based on the URL path and provided data.

Model Documentation#

The model object should be structured to provide necessary configuration and data for the breadcrumb navigation:
Model Structure#
id: String
A unique identifier for the component, used for the component’s id attribute and potential custom styling.
cssClass: String
Optional CSS class(es) for additional styling of the breadcrumb container.
header: String
Optional header text for the breadcrumb container.
Example Model#
{
  "id": "breadcrumb-1",
  "cssClass": "custom-breadcrumb",
  "header": "You are here"
}

Component Structure#

The component utilizes Vue.js to handle dynamic breadcrumb generation based on the current URL path and context.

HTML Template#

The HTML template for the breadcrumb component is as follows:

JavaScript#

The JavaScript part of the component manages the dynamic data and logic for rendering breadcrumbs:

Explanation#

1.
Props:
model: The component receives a model object as a prop, which contains configuration and data for rendering.
2.
Data:
data: Stores the model object.
path: Holds the current path segment derived from the URL.
title: Represents the current title for the breadcrumb navigation.
categories: An array of category objects used to generate breadcrumb links.
3.
Methods:
getAlignmentClass(alignment): Determines the CSS class for text alignment based on the alignment value.
4.
Created Lifecycle Hook:
created(): Processes the URL to determine the current path and title. It also fetches category data based on the path and updates the categories and title properties.
5.
Mounted Lifecycle Hook:
mounted(): Intended for additional setup if required, such as initializing plugins or making further data fetches.

Steps to Create Your Own Breadcrumb 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 breadcrumb navigation list.
Use Vue.js directives (v-if, v-for, :href, etc.) for dynamic rendering.
3.
Implement JavaScript Logic:
Define props for the model object.
Initialize data and implement methods for functionality.
Use the created() lifecycle hook to handle URL parsing and data fetching.
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 various 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 complete guide to the Breadcrumb Component, including how to configure and use it effectively.
Previous
Brands Carousel
Next
Call To Action
Built with