是的,微信小程序支持手机定位功能,可以获取手机的经纬度坐标。要使用定位功能,需要在小程序的配置文件中(小程序的 project.config.json 文件)配置定位权限,然后使用 wx.getLocation API 来获取手机的定位信息。
例如,以下代码段可以获取手机的经纬度坐标:
wx.getLocation({
type: 'wgs84',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
console.log(`纬度: ${latitu