if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(pos) {
model.address.geo = {
lat: pos.coords.latitude.toFixed(5),
lng: pos.coords.longitude.toFixed(5)
};
});
} else {
alert("Geolocation is not supported by this browser.");
}
js获取 gps坐标
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)