js获取当前位置
js获取当前位置,首先需要https下,而且需要允许浏览器获取位置
function getLocation() {
return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition((pos) => {
const coords = pos.coords || {}
const { latitude, longitude } = coords
co
原创
2021-12-14 15:32:25 ·
4259 阅读 ·
0 评论