点击按钮获取当前位置

xiaoxiao2021-02-28  82

wxml:

  <view class="classname" bindtap="openMap">测试微信小程序定位</view>

js:

  // 获取地理位置

  openMap: function () {     console.log(11111)     wx.getLocation({       type: 'gcj02', // 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标       success: function (res) {         // success         console.log(22222)         wx.openLocation({           latitude: res.latitude, // 纬度,范围为-90~90,负数表示南纬           longitude: res.longitude, // 经度,范围为-180~180,负数表示西经           scale: 28, // 缩放比例                   })       }     })   },
转载请注明原文地址: https://www.6miu.com/read-79335.html

最新回复(0)