javascript - Microsoft.Maps.SDKMap 未定义,在 BingMaps V8 中创建对象时
问题描述
创建 bingmap 实例时,SDKMap 未定义。以下代码中是否缺少任何凭据?
function GetBingMap(){
var vcredentials = "<%=this.credentialKey%>" //credential Key
var vzoomLevel = Number("<%=this.zoom%>"); //Zoom Level
// Create the Map instance
map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), //div map load
{
credentials: vcredentials, //credential
zoom: vzoomLevel, //zoom level
showZoomButtons: false, // enable Zoom Buttons
showLocateMeButton: false, // show Locate me button
showMapTypeSelector: false,//enable Map type selector
showScalebar: false,//enable scale bar
showTermsLink: false//enable terms link
});
this.map= map;
解决方案
确保在调用 GetBingMap 函数之前已加载 Bing 地图源代码。在您的代码尝试创建地图实例之前,它听起来还没有完全加载。如果您在脚本标记的脚本引用中使用 async/defer,请将其删除。
推荐阅读
- python - 如何在python中将字符串转换为时间?
- python - 如何使用 DjangoForm 引发 ValidationError?
- bluetooth - 如何处理报告地图并从蓝牙键盘读取按键?
- heroku - 我无法部署到 vercel,因为我收到错误:Specified images.domains should be an Array of strings received invalid values ()
- python - 如何旋转 Tableau 中的所有列
- php - 在 Woocommerce 变量产品中的所有属性标签末尾添加一个红色星号
- discord.py - Discord.py - 在函数仍在运行时执行函数中的函数
- facebook-graph-api - Facebook API:无法安排视频
- flutter - 我在哪里可以保存 Android 和 IOS 上相机插件创建的视频文件?
- sql - SQL:如何使用多列分区计算百分比增加