title: Taro.createMapContext(mapId, component)
sidebar_label: createMapContext
Creates the MapContext object for the map.
Type
(mapId: string, component?: Record<string, any>) => MapContext
Parameters
Property | Type | Description |
---|---|---|
mapId | string |
ID of the <map/> component |
component | Record<string, any> |
Under custom components, current component instance “this” operates the <map/> component |
Sample Code
const mapCtx = Taro.createMapContext('myMap')
API Support
API | WeChat Mini-Program | H5 | React Native |
---|---|---|---|
Taro.createMapContext | ✔️ |