GIS-ArcGIS JS API FeatureLayer图层绑定事件的几种方式

一、以下四种方式均可以
importantProvinceLayer.on("click", DoIdentify);
dojo.connect(importantProvinceLayer, "onClick", DoIdentify);
on(importantProvinceLayer, "click", DoIdentify);
connect.connect(importantProvinceLayer, "onClick", DoIdentify);
 
二、引入的包
require(["dojo/dom", "dojo/dom-construct",
"esri/map", "esri/layers/FeatureLayer",
"esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol",
"esri/renderers/SimpleRenderer", "esri/graphic", "esri/lang", "myModules/InfoWindow", "esri/InfoTemplate",
"esri/Color", "dojo/number", "dojo/dom-style",
"esri/layers/ImageParameters",
"esri/dijit/Bookmarks", "esri/tasks/GeometryService", "esri/tasks/LengthsParameters", "esri/tasks/AreasAndLengthsParameters",
"esri/dijit/HomeButton",
"esri/layers/FeatureLayer", "esri/layers/GraphicsLayer", "esri/InfoTemplate", "esri/Graphic",
"esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol",
"esri/renderers/SimpleRenderer", "esri/graphic", "esri/lang",
"esri/Color", "esri/tasks/Query", "esri/tasks/QueryTask", "esri/SpatialReference",
"esri/geometry/Point", "esri/geometry/Polyline", "esri/geometry/Polygon",
"esri/dijit/Scalebar",
"esri/tasks/FindTask",
"esri/tasks/FindParameters",
"esri/tasks/Identify",
"esri/tasks/IdentifyTask",
"esri/tasks/IdentifyParameters",
"dojo/number",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane",
"dijit/TooltipDialog",
"esri/dijit/OverviewMap",
"esri/dijit/BasemapToggle", "esri/basemaps",
"dojo/parser",
"esri/dijit/BasemapGallery", "esri/arcgis/utils",
"esri/dijit/Popup", "esri/dijit/PopupTemplate",
"dojo/_base/connect", "dijit/registry",
"esri/toolbars/draw",
"esri/toolbars/navigation",
"dojo/dom", "dojo/dom-style", "dojo/on",
"dijit/TooltipDialog", "dijit/popup", "dojo/domReady!"
], function (dom, domConstruct,
Map, FeatureLayer,
SimpleFillSymbol, SimpleLineSymbol,
SimpleRenderer, Graphic, esriLang, InfoWindow, InfoTemplate,
Color, number, domStyle,
ImageParameters,
Bookmarks,
GeometryService,
LengthsParameters,
AreasAndLengthsParameters,
HomeButton,
FeatureLayer,
GraphicsLayer,
InfoTemplate,
Graphic,
SimpleFillSymbol,
SimpleLineSymbol,
SimpleMarkerSymbol,
SimpleLineSymbol,
SimpleRenderer,
Graphic,
esriLang,
Color,
Query,
QueryTask,
SpatialReference,
Point,
Polyline,
Polygon,
Scalebar,
FindTask,
FindParameters,
Identify,
IdentifyTask,
IdentifyParameters,
number,
BorderContainer,
ContentPane,
TitlePane,
TooltipDialog,
OverviewMap,
BasemapToggle,
esriBasemaps, parser, BasemapGallery, arcgisUtils, Popup, PopupTemplate, connect, registry, Draw, Navigation, dom, domStyle, on,
TooltipDialog, dijitPopup
) {
 
//todo
 
});
原文地址:https://www.cnblogs.com/defineconst/p/7239255.html