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

Banner Carousel

Documentation: Banner Carousel Component#

This documentation covers the Banner Carousel Component, a Vue.js component designed to display a series of banner elements in a carousel format. The component supports dynamic styling and layout based on the provided model.

Overview#

The Banner Carousel Component presents a collection of banners within a carousel layout. Each banner can have background images, text, and buttons. The component's layout and appearance are customizable through a model object.

Model Documentation#

The Banner Carousel Component relies on a model object that defines its behavior and appearance. Here's an in-depth look at the model properties:
Model Structure#
The model object contains the following properties:
id: String
The unique identifier for the component, used for styling and referencing the component.
cssClass: String
Optional CSS class(es) for styling the outer container of the carousel. Allows for custom styling.
header: String
Optional header text to display above the carousel. This is rendered as an <h2> element.
alignment: Number
Defines the alignment of the header text. Possible values are:
1: Left aligned (justify-content-start)
2: Center aligned (justify-content-center)
3: Right aligned (justify-content-end)
banners: Array
An array of banner objects to be displayed in the carousel. Each banner object contains:
backgroundImage: Object
link: String
URL to the background image.
backgroundColor: String
Background color for the banner. This is applied using inline styles.
header: String
Header text displayed on the banner.
subHeader: String
Subheader text displayed below the header.
text: String
Main text content for the banner.
textColor: String
Color of the text, applied using inline styles.
buttonText: String
Text for the button, if present.
buttonLink: String
URL that the button links to.
image: Object
link: String
URL to an additional image to be displayed on the banner.
columns: Number
Defines the layout pattern for the banners based on the number of columns. Possible values are 1 through 6. The layout pattern determines the width distribution of the banners.
Example Model#
Here is an example of what the model object might look like:
{
  "id": "banner-carousel-1",
  "cssClass": "custom-carousel",
  "header": "Our Latest Offers",
  "alignment": 2,
  "banners": [
    {
      "backgroundImage": { "link": "https://example.com/image1.jpg" },
      "backgroundColor": "#f8f9fa",
      "header": "Summer Sale",
      "subHeader": "Up to 50% Off",
      "text": "Check out our summer sale with discounts up to 50% on selected items.",
      "textColor": "#333",
      "buttonText": "Shop Now",
      "buttonLink": "https://example.com/summer-sale",
      "image": { "link": "https://example.com/banner1.jpg" }
    },
    {
      "backgroundImage": { "link": "https://example.com/image2.jpg" },
      "backgroundColor": "#e9ecef",
      "header": "New Arrivals",
      "subHeader": "Fresh Styles",
      "text": "Explore the latest trends and new arrivals in our store.",
      "textColor": "#666",
      "buttonText": "Discover More",
      "buttonLink": "https://example.com/new-arrivals",
      "image": { "link": "https://example.com/banner2.jpg" }
    }
  ],
  "columns": 3
}

Component Structure#

The component is defined in Vue.js with the following features:
1.
HTML Template: Defines the structure and layout of the carousel and banners.
2.
JavaScript Logic: Manages data, methods, and lifecycle hooks.

HTML Template#

Here is the HTML structure for the Banner Carousel Component:

JavaScript#

The JavaScript file manages the component's data, methods, and lifecycle hooks:

Steps to Create Your Own Banner Carousel Component#

1.
Set Up the Vue Component:
Define the component using Vue.component() or app.component().
Specify the HTML template using the template option.
2.
Create the Template:
Structure your HTML to include the carousel layout and banner elements.
Use Vue.js directives (v-if, v-for, :class, etc.) to bind data and control rendering.
3.
Implement the JavaScript Logic:
Define props to receive the model data from parent components.
Use data() to initialize component state.
Implement created() to determine the layout pattern based on the number of columns.
Write methods to handle dynamic alignment classes.
4.
Integrate External Libraries:
Ensure you have included any required libraries for carousel functionality and styling.
5.
Testing and Debugging:
Test the component in various scenarios to ensure proper functionality and responsiveness.
Debug any issues related to data binding, component rendering, or styling.
6.
Deploy the Component:
Once tested, deploy the component as part of your Vue.js application.
This guide provides a template for creating a custom Banner Carousel component in Vue.js. Customize the HTML and JavaScript according to your specific requirements and integrate any additional features as needed.
Previous
Announcement
Next
Banner With Products Carousel
Built with