Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
704 views
in Technique[技术] by (71.8m points)

高德地图 Loca is not defined

之前项目使用1.4x的高德地图一直没问题, 今天准备换成2.0API的 问题就来了

代码如下:
在 vue.config.js 中配置cnd 和 externals

```

cdn: {

    prefetch: [],
    css: [],
    js: [
      'https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.js',
      'https://webapi.amap.com/maps?key=bdecc03f57f71230c43ae5d4d55383f8&v=2.0&plugin=Map3D',
      'https://webapi.amap.com/ui/1.1/main.js',
      'https://webapi.amap.com/loca?key=bdecc03f57f71230c43ae5d4d55383f8&v=1.3.2'
    ]
  }

configureWebpack: {

externals: {
  AMap: 'AMap',
  Loca: 'Loca',
  echarts: 'echarts'
}

},

页面中已加载
![image.png](/img/bVbKs5p)
![image.png](/img/bVbKs5u)
![image.png](/img/bVbKs5C)
1.4x的时候也是这么写的没出问题, 2.0怎么就出了这么个问题?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...