先注册账号 => 注册成为开发者 => 控制台 => 应用管理 => 我的应用 => 创建应用 => 根据需求创建 => 创建后会有一个访问AK
=>添加meta标签
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
=>设置容器样式
<style type="text/css"> html{height:100%} body{height:100%;margin:0px;padding:0px} #container{height:100%} </style>
=>引用百度地图Api文件
<script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=您的密钥"></script>
=>在js或vue文件中配置
let _geo = new window.BMapGL.Geolocation()
_geo.getCurrentPosition(function(geo) {
console.log(geo);
}, {enableHighAccuracy: true, timeout: 6})
}