Javascript “类型错误”;null没有属性“;添加控件时
这里是诺基亚新手 我添加了简单的(来自示例)代码来显示带有各种控件的地图。Javascript “类型错误”;null没有属性“;添加控件时,javascript,here-api,Javascript,Here Api,这里是诺基亚新手 我添加了简单的(来自示例)代码来显示带有各种控件的地图。 该映射显示控件的ok(正常),但不显示控件,控制台中显示错误“TypeError:null没有属性” 我尝试过一次添加一个控件,但添加任何控件都会产生错误 我已经找过了,但什么也没找到。当然,它必须非常简单 下面是代码的摘录。 任何帮助都将不胜感激 { nokia.Settings.set("app_id", "myid"); nokia.Settings.set("app_code", "mycod
该映射显示控件的ok(正常),但不显示控件,控制台中显示错误“TypeError:null没有属性” 我尝试过一次添加一个控件,但添加任何控件都会产生错误 我已经找过了,但什么也没找到。当然,它必须非常简单 下面是代码的摘录。 任何帮助都将不胜感激
{
nokia.Settings.set("app_id", "myid");
nokia.Settings.set("app_code", "mycode");
// Use staging environment (remove the line for production environment)
nokia.Settings.set("serviceMode", "cit");
(document.location.protocol == "https:") &&
nokia.Settings.set("secureConnection", "force");
var mapContainer = document.getElementById(mySelf.options["id"]);
// Create a map inside the map container DOM node
if(mySelf.options["controls"] == true){
controls = [
new nokia.maps.map.component.ZoomBar(),
new nokia.maps.map.component.Behavior(),
new nokia.maps.map.component.TypeSelector(),
new nokia.maps.map.component.Traffic(),
new nokia.maps.map.component.PublicTransport(),
new nokia.maps.map.component.DistanceMeasurement(),
new nokia.maps.map.component.Overview(),
new nokia.maps.map.component.ScaleBar(),
new nokia.maps.positioning.component.Positioning(),
new nokia.maps.map.component.ContextMenu(),
new nokia.maps.map.component.ZoomRectangle(),
new nokia.maps.map.component.TrafficIncidents()
];
} else {
controls = [
];
}
this.map = new nokia.maps.map.Display(mapContainer, {
center: [52.51, 13.4],
zoomLevel: 10,
components: controls
});
}
解决了。MAPAPI查看一个名为self的全局变量。我在一个函数中设置了一个self=this,前面没有var。MAPAPI真的有点麻烦了。我花了几个小时才找到这个。希望它能帮助其他人。哪一行抛出了错误?什么是我自己?错误在base.js第297行。{myelf=this;}TypeError:null没有属性第297行use:function(){},g:function(a){this.li(a)},Jn:function(a){var c=b.FontHelper.parse;this.re | |(this.re={});var f=this.re[a];f=this.re[a]=c(a));return f},re:function(a,c){var f,k=ovi.type(a),d;if(k==“d=”string=”f=this.re[a];f=f=f[a];(f=f=self document document k=”元素&&a、 documentElement)f=(d=a).documentElement;ovi.type(f)!=“element”&&b.d(“svgMarkup需要是有效的SVG字符串或XML文档!”);this.M=c | | new p;this.mi(f);返回d},解析SVG:function(a){this.Re(a);返回this.M.getIDL(),