MapContext.moveToLocation

解释:将地图中心移动到当前定位点,需要配合 map 组件的 show-location 使用。

方法参数

示例

跳转编辑工具

在开发者工具中打开

在 WEB IDE 中打开

扫码体验

代码示例

百度智能小程序

请使用百度APP扫码

图片示例

MapContext.moveToLocation - 图2

代码示例

  • SWAN
  • JS
  1. <view class="wrap">
  2. <map id="myMap"
  3. longitude="{{longitude}}"
  4. latitude="{{latitude}}"
  5. style="width: 100%"
  6. show-location
  7. >
  8. </map>
  9. <button type="primary" bindtap="moveToLocation">移动到当前定位点</button>
  10. </view>