vue amap

index.html

<head>
    ...
    <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=xxxxxx"></script> 
  </head>

vue.config.js

module.exports = {
    configureWebpack: {
     externals: {
      AMap: "window.AMap"
     }
    }
   };
   

组件中使用

import AMap from "AMap";

  mounted() {
    new AMap.Map("GDMap", {
      center: [119.034725, 33.631893],
      zoom: 14,
    });
}
原文地址:https://www.cnblogs.com/fenle/p/13214360.html