arcgis api parser.parse is not a function


1.png

这是我的代码,但是总是出现下面的错误

2.png

 
js文件肯定是全引入了,因为用的是在线的js,不会出现配置不对的问题,此问题求解啊。
已邀请:

goldenlimit - Major in MIS and minor in GIS, graduated from University of Alabama. GIS is not a simply tool but a way of exploring the unknow

赞同来自: lucahan

你好lucahan,
 
出现这个错误的原因是因为你引用的顺序和你在function里面的顺序不同造成的,dojo require 要求引用和定义的顺序必须相呼应,比方说你在require里面的顺序如果是这样的:
require([
        "esri/map", "esri/InfoTemplate", "esri/layers/FeatureLayer",
        "dojo/parser", "dojo/domReady!"
      ],
 
你function 里面的顺序必须是一样的:Map, InfoTemplate, FeatureLayer,
        parser
每个都是互相对应的, 而你的里面顺序都不对
 
你看一下这个sample code 你就明白了:https://jsfiddle.net/rkndmz8e/

要回复问题请先登录注册