# getLocation 获取当前的地理位置、速度

# getLocation(object)

该函数可以获取当前的地理位置、速度。同时封装了对位置获取失败的处理

  • object <Object> 配置参数,详见:https://uniapp.dcloud.net.cn/api/location/location.html#getlocation
export default{
	data() {
		return {
			
		}
	},
	onLoad() {
		uni.$u.getLocation().then((res)=>{
			console.log(res)
		})
	}
}
✅ Copy success!
上次更新时间: 2025/9/11 13:27:54
🌟 真诚邀请 🌟
如果你觉得本项目对你有帮助
欢迎访问我们的Gitee/Github 仓库为我们点个 Star!
×