vue+百度地图,显示BMap未定义,申请秘钥了

在index.js中

<script type="text/javascript" src="http://api.map.baidu.com/api?ak=“我的密钥”&v=2.0"></script>

在map.vue中

https://img3.mukewang.com/5c7e264600018d0804660079.jpg

https://img4.mukewang.com/5c7e26470001acfe08000499.jpg

可是运行老总是出现Bmap未定义?求大神解答!谢谢

呼如林
浏览 1501回答 1
1回答

呼唤远方

...mounted () {&nbsp; &nbsp; var that = this;&nbsp; &nbsp; that.$nextTick(&nbsp; &nbsp; &nbsp; that.createMap(window.BMap)&nbsp; &nbsp; )},methods: {&nbsp; &nbsp; createMap (BMap) {&nbsp; &nbsp; &nbsp; &nbsp; ....&nbsp; &nbsp; &nbsp; &nbsp; var map = new BMap.Map('XSDFXPage', {...})&nbsp; &nbsp; &nbsp; &nbsp; ....&nbsp; &nbsp; }}....我们项目的大致代码如上!
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript