# 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/10/24 23:49:22
当前文档拷贝至3.x版本,尚不完善,我们正在努力完善中,欢迎您的反馈和参与改进。
×