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

Map

Documentation: Map Component#

The Map Component provides an embedded map view using Google Maps. It allows displaying a location based on address or coordinates. This component includes customizable options such as map zoom level and alignment for the header.

Overview#

The Map Component integrates Google Maps into your application, allowing users to view a specific location. It can be configured to display a map based on an address or geographical coordinates. The component's template includes a header, optional image, and an embedded map iframe.

Model Documentation#

The model object for the Map Component contains configuration options that define how the map should be displayed and customized.
Model Structure#
id: String
A unique identifier for the component. Used for element targeting and CSS styling.
cssClass: String
Optional CSS class(es) to apply to the component's container.
header: String
Optional header text to display at the top of the map component.
address: Object
Contains address details, including:
address1: String
Street address.
city: String
City.
postalCode: String
Postal code.
latitude: Number
Latitude for location coordinates.
longitude: Number
Longitude for location coordinates.
zoom: Number
Zoom level for the map view.
Example Model#
{
  "id": "mapComponent",
  "cssClass": "custom-map-class",
  "header": "Our Location",
  "address": {
    "address1": "1600 Amphitheatre Parkway",
    "city": "Mountain View",
    "postalCode": "94043"
  },
  "latitude": 37.422,
  "longitude": -122.084,
  "zoom": 14
}

Component Structure#

The Map Component consists of:
1.
HTML Template: Defines the structure and layout of the map, including optional header and image.
2.
JavaScript: Manages map URL generation, alignment, and reactive data.

HTML Template#

The HTML template provides the layout for the map component. It includes an optional header, an image, and an embedded iframe for displaying the map.

JavaScript#

The JavaScript code handles the dynamic generation of the map URL and provides methods for alignment and configuration.

Explanation#

Map URL Generation: The GetMapUrl method constructs the Google Maps URL based on provided address or coordinates and zoom level. It uses Google Maps' Embed API to generate the map iframe source URL.
Dynamic Data Handling: Data such as the address, latitude, longitude, and zoom level are reactive, allowing the component to update the map view based on these values.
Alignment Class: The getAlignmentClass method applies CSS classes to align the header based on the alignment value provided in the model.

Usage#

To use the Map Component in your Vue.js application:
1.
Include the Component: Register the Map component in your Vue app.
2.
Provide the Model: Pass a model object to configure the map's appearance and behavior.
3.
Render the Component: Include the Map component in your template and provide the necessary data.
Previous
Login
Next
Nav Bar
Built with