# 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!
新版发布
uView Next 4.0重磅发布,支持uniapp、uniapp x、鸿蒙、小程序、全端兼容的UI框架
×