uni端代码
// test.vue  
onReady(() => {  
uni.getLocation({  
    type: 'gcj02',  
    geocode: true,  
    isHighAccuracy: true,  
    success: function (res) {  
      longitude.value = res.longitude  
      latitude.value = res.latitude  
      markers.value.push({  
        // id: id.value++,  
        latitude: latitude.value,  
        longitude: longitude.value,  
        // iconPath: '/src/assets/images/map.png',  
      })  
      console.log(markers.value)  
      console.log(`当前位置的经度:${res.longitude},当前位置的纬度:${res.latitude}`)  
      uni.showModal({  
        content: `当前位置的经度:${res.longitude},当前位置的纬度:${res.latitude}`,  
      })  
    },  
    fail: (error) => {  
      uni.showModal({  
        content: JSON.stringify(error),  
      })  
    },  
  })  
})