JS引用高德地图报错: AMap is not defined
1:我在页面里引用了高德地图的根据输入地点获取经纬度插件,代码如下
<script type="text/javascript">
window._AMapSecurityConfig = {
securityJsCode: '你的秘钥密码',
}
</script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=2.@&key=xxxxxxxxxxxxxxxx"></script>
mounted() {
// 创建地图实例
var map = new AMap.Map('container', {
zoom: 12,
resizeEnable: true
})
var marker = new AMap.Marker({
position: new AMap.LngLat(116.29537571881102, 39.842559532456974), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
title: '北京丰台医院' })
},
2:解决方法
网上试过了好多方法都没有效果
<script src="https://webapi.amap.com/maps?v=1.4.15&key=xxxxxxxxxxxx"></script>
修改一下 版本号就好了。
3:效果图