如:index.html中:

<script src="http://unpkg.com/vue/dist/vue.js"></script>
<!--高德地图 -->
<script src="//webapi.amap.com/maps?v=1.3&key=e1dedc6bdd765d46693986ff7ff969f4"></script>
<script src="//webapi.amap.com/ui/1.0/main.js"></script>

需要在webpack中配置externals 以供其他地方使用
build/webpack.base.conf.js中的module.exports的最后加入如下配置:

externals: {
    vue: "Vue",
    AMap: "window.AMap",
    AMapUI: "window.AMapUI"
  }

 

Logo

前往低代码交流专区

更多推荐