需求:就是在地图上划划划,然后按一下再跳转到当前所在的位置
map组件里面啊,必须添加 show-location='true' ,否则,跳转不到当前位置
html
<view class="map">
<map :style="height" id="map" :longitude="longitude" :latitude="latitude" scale="18" :polyline="polyline" :markers="markers"
show-location :controls="controls" show-location='true' style="width: 100%; height: 300px;">
</map>
<button @click="controltap">回到当前位置</button>
<button @click="start" :class="choosed">开始</button>
<button @click="end">结束</button>
</view>
js
controltap() {
let mpCtx = wx.createMapContext("map");
mpCtx.moveToLocation();
}