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

Layout

Documentation: Layout Component#

The Layout Component is a versatile component designed to manage and organize a dynamic collection of child components based on a given model. It allows for the creation of complex layouts by arranging various components as specified in the model. This component is particularly useful for building flexible and modular interfaces.

Overview#

The Layout Component acts as a container for multiple other components. It takes a model that defines an array of components, dynamically renders them, and handles their layout within the component. Unlike typical components, the Layout Component manages its own template and JavaScript logic, and does not inherit or rely on the templates and scripts of the child components directly.

Model Documentation#

The model object is used to configure the child components that will be rendered within the Layout Component.
Model Structure#
components: Array
An array where each item is an object representing a child component. The array items typically include:
Example Model#
{
  "components": [
    {
    ...
    },
    {
     ...
    }
  ]
}

Component Structure#

The Layout Component consists of:
1.
Template: Defines the layout structure and dynamically inserts child components based on the model.
2.
JavaScript: Contains the logic for rendering child components and handling their props.

HTML Template#

The HTML template for the Layout Component dynamically renders child components based on the model.components array.

JavaScript#

The JavaScript code manages the dynamic rendering of components and handles the model data.

Explanation#

Template and Logic: The Layout Component manages its own template and JavaScript, making it independent of the specific implementations of the child components. This allows for flexibility and reuse of the component in various contexts.

Usage#

To use the Layout Component, you need to provide a model that defines the components to be rendered. Here is an example of how to integrate it into a Vue.js application:
1.
Include the Component: Register the Layout component in your Vue app.
2.
Provide the Model: Pass a model object to the component that specifies which child components to render and their properties.
3.
Render the Component: Include the Layout component in your template and provide the necessary data.
Previous
Last Visited Products
Next
Login
Built with