未捕获的类型错误:无法读取 arcgis 中未定义的属性“on" [英] Uncaught TypeError: Cannot read property 'on' of undefined in arcgis
本文介绍了未捕获的类型错误:无法读取 arcgis 中未定义的属性“on"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试显示导航工具和切换底图.当我将它组合起来时,两者都运行良好,显示未捕获类型错误:无法读取未定义的属性on".谁能告诉我什么是错误
<头><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/><title></title><link rel="stylesheet" href="https://js.arcgis.com/3.15/dijit/themes/claro/claro.css"><link rel="stylesheet" href="https://js.arcgis.com/3.15/esri/css/esri.css"><风格>html, body, #map { 高度: 100%;宽度:100%;边距:0;填充:0;}#转变{位置:绝对;右:20px;顶部:10px;z-索引:999;}#底图画廊{宽度:380px;高度:280px;}#HomeButton {位置:绝对;顶部:95px;左:20px;z-索引:50;}#导航工具栏{显示:块;位置:绝对;z-索引:2;顶部:10px;左:2px}.zoominIcon {显示:块;位置:绝对;宽度:16px;高度:16px;}.zoomoutIcon {位置:绝对;宽度:16px;高度:16px;}.zoomfullextIcon {位置:绝对;宽度:16px;高度:16px;}.zoomprevIcon {位置:绝对;宽度:16px;高度:16px;}.zoomnextIcon {位置:绝对;宽度:16px;高度:16px;}.panIcon {位置:绝对;宽度:16px;高度:16px;}.deactivateIcon {位置:绝对;宽度:16px;高度:16px;}</风格><script src="https://js.arcgis.com/3.15/"></script><脚本>无功地图;要求(["esri/地图","esri/dijit/BasemapGallery","esri/dijit/HomeButton","esri/工具栏/导航","道场/上","道场/解析器","dijit/注册表","dijit/工具栏","dijit/表单/按钮",道场/domReady!"], 功能(地图,底图画廊,主页按钮,导航,在,解析器,登记处){parser.parse();var 导航工具栏;地图 = 新地图(地图",{底图:地形",中心:[-105.255, 40.022],缩放:13,滑块:假});//添加底图库,在这种情况下,我们将显示来自 ArcGIS.com 的地图,包括 bing 地图var basemapGallery = new BasemapGallery({showArcGISBasemaps: 真,地图:地图}, "底图画廊");basemapGallery.on('加载',function(){basemapGallery.remove('basemap_1');basemapGallery.remove('basemap_2');basemapGallery.remove('basemap_3');basemapGallery.remove('basemap_4');basemapGallery.remove('basemap_5');basemapGallery.remove('basemap_8');});basemapGallery.startup();basemapGallery.on(错误",函数(味精){console.log("底图库错误:", msg);});var home = new HomeButton({地图:地图}, "HomeButton");家.启动();navToolbar = 新导航(地图);on(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);registry.byId("zoomin").on("click", function () {navToolbar.activate(Navigation.ZOOM_IN);});registry.byId("zoomout").on("click", function () {navToolbar.activate(Navigation.ZOOM_OUT);});registry.byId("zoomfullext").on("click", function () {navToolbar.zoomToFullExtent();});registry.byId("zoomprev").on("点击", function () {navToolbar.zoomToPrevExtent();});registry.byId("zoomnext").on("click", function () {navToolbar.zoomToNextExtent();});registry.byId("pan").on("click", function () {navToolbar.activate(Navigation.PAN);});registry.byId("deactivate").on("click", function () {navToolbar.deactivate();});函数extentHistoryChangeHandler(){registry.byId("zoomprev").disabled = navToolbar.isFirstExtent();registry.byId("zoomnext").disabled = navToolbar.isLastExtent();}});头部><body class="claro"><div id="地图"><div id="navToolbar" data-dojo-type="dijit/Toolbar"><div data-dojo-type="dijit/form/Button" id="zoomin" data-dojo-props="iconClass:'zoominIcon'">放大</div><div data-dojo-type="dijit/form/Button" id="zoomout" data-dojo-props="iconClass:'zoomoutIcon'">缩小</div><div data-dojo-type="dijit/form/Button" id="zoomfullext" data-dojo-props="iconClass:'zoomfullextIcon'">全图</div><div data-dojo-type="dijit/form/Button" id="zoomprev" data-dojo-props="iconClass:'zoomprevIcon'">上一个范围</div><div data-dojo-type="dijit/form/Button" id="zoomnext" data-dojo-props="iconClass:'zoomnextIcon'">下一个范围</div><div data-dojo-type="dijit/form/Button" id="pan" data-dojo-props="iconClass:'panIcon'">Pan</div><div data-dojo-type="dijit/form/Button" id="deactivate" data-dojo-props="iconClass:'deactivateIcon'">Deactivate</div>
<div id="HomeButton"></div><div id="switch" data-dojo-type="dijit/TitlePane" data-dojo-props="title:'Switch Basemap', Closable:false, open:false"><div id="basemapGallery"></div>