baiduMap.js
export function baiduMap(ak) {
return new Promise(function(resolve, reject) {
// 异步加载
var script = document.createElement('script')
script.type = 'text/javascript'
script.src = `http://api.map.baidu.com/api?v=2.0&ak=${ak}&callback=MapLoadSuccess`
script.onerror = reject
document.head.appendChild(script)
window.MapLoadSuccess = function() {
var link = document.createElement('link')
link.rel = 'stylesheet'
link.href = `http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css`
document.head.appendChild(link)
// BMap加载完成,开始加载libs