动态加载天地图
export async function mapInit(elId) {
console.log("开始执行")
return new Promise((resolve, reject) => {
console.log("开始执行2")
let script = document.createElement('script');
script.type = 'text/JavaScript';
script.src = "http://api.tianditu.gov.cn/api?v=4.0&tk=#########"
console.log("开始执行3")
script.onload =function (){
console.log("js加载完成")
let map = new T.Map(elId);
resolve(map)
}
let head = document.head;
head.appendChild(script);
})
}