// pages/order/station/index.js Page({ data: { latitude: 23.099994, longitude: 113.324520, markers: [{ id: 1, latitude: 23.099994, longitude: 113.324520, name: 'T.I.T 创意园' }], covers: [{ latitude: 23.099994, longitude: 113.344520, // iconPath: '/image/location.png' }, { latitude: 23.099994, longitude: 113.304520, // iconPath: '/image/location.png' }] }, onReady: function (e) { this.mapCtx = wx.createMapContext('wxmap') var that = this wx.getLocation({ type: 'wgs84', success(res) { that.setData({ latitude: res.latitude, longitude: res.longitude }) that.mapCtx.moveToLocation() } }) }, translateMarker: function () { this.mapCtx.translateMarker({ markerId: 1, autoRotate: true, duration: 1000, destination: { latitude: 23.10229, longitude: 113.3345211, }, animationEnd() { console.log('animation end') } }) }, includePoints: function () { this.mapCtx.includePoints({ padding: [10], points: [{ latitude: 23.10229, longitude: 113.3345211, }, { latitude: 23.00229, longitude: 113.3345211, }] }) }, //根据经纬度在地图上显示 openLocation: function (e) { var value = e.detail.value wx.openLocation({ latitude: 23.10229, longitude: 113.3345211 }) } })