高德地图 AMap.xxx is not constructor 错误

AMap.xxx is not constructor

出现这个问题是map的插件还没有加载完。

解决办法:

  1. 在public文件夹下的index.html直接引入地图的sdk,也可以单独引入到组件下面。

 在index.html中写入

<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.4&key=你的key&plugin=AMap.Geocoder&plugin=AMap.Autocomplete&plugin=AMap.PolyEditor"></script>

需要引入的插件

&plugin=AMap.Geocoder&plugin=AMap.Autocomplete&plugin=AMap.PolyEditor

或者 

  <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key='key自己申请'&plugin=AMap.MouseTool,AMap.Geolocation,AMap.ControlBar,Map3D,AMap.DistrictSearch,AMap.RangingTool,AMap.PolyEditor"></script>

 &plugin=AMap.MouseTool,AMap.Geolocation,AMap.ControlBar,Map3D,AMap.DistrictSearch,AMap.RangingTool,AMap.PolyEditor