ty.createMapContext(string mapId)
基础库 2.0.12 开始支持, 低版本需做兼容处理。
创建 map 上下文 MapContext 对象。
参数
string mapId
map 组件的 id
返回值
MapContext
MapContext 实例,可通过 ty.createMapContext 获取。
MapContext 通过 id 跟一个 map 组件绑定,操作对应的 map 组件。
方法
MapContext.addMarkers
添加 marker
MapContext.removeMarkers
移除 marker