记录一下最近项目中实现的一个关于路线生成并且在路线上有小车从起点向终点移动的一个功能
最终实现效果如下:

话不多说直接上代码
地图显示容器
<view class="map"> <map id="map_container" :scale="mapScale" :markers="markers" :polyline="polyline" :show-location="true"></map> </view>
drawRoute() { const _this = this; //starlongitude为起始点的纬度 //starlatitude为起始点的经度 //key为自己申请的高德地图的key // 使用微信小程序的路径规划API获取路径 uni.request({ url: `https://restapi.amap.com/v3/direction/driving?key=${this.key}&origin=${this.starlongitude},${this.starlatitude}&destination=${this.endlongitude},${this.endlatitude}`, success: (res) => { if (res.statusCode === 200 &&

最低0.47元/天 解锁文章
4827

被折叠的 条评论
为什么被折叠?



