自己动手实现一个跑步小程序 用到的方法:wx.onLocationChange,监听实时地理位置变化事件,需结合 wx.startLocationUpdateBackground
,wx.startLocationUpdate
使用。
地图组件
定义一个全屏的地图,地图配置项经纬度(longitude
,latitude
),缩放(scale
),标记点(markers
),路线(polyline
)等
<view class="map"><map id="map" longitude="{
{longitude}}" latitude="{
{latitude}}" scale="{
{scale}}" markers="{
{markers}}"polyline="{
{polyline}}" style="width: 100%; height: 100%"></map>
</view>
地图配置项字段
data: {latitude: '',longitude: '',scale: 16,markers: [],polyline: [{points: [],color: '#FB8337',width: