const seattleLayer = new FeatureLayer({ url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Puget_Sound_BG_demographics/FeatureServer/0", title: "Seattle block groups", renderer: renderer, popupTemplate: { // autocast as esri/PopupTemplate title: "Block Group {FID_Block_Group}", content: "{COL_DEG} adults 25 years old and older in this block group have a college degree. " + "{NO_COL_DEG} adults do not have a college degree." }, // show only block groups in Seattle definitionExpression: "City = 'Seattle' AND EDUCBASECY > 0", opacity: 0.9 });
PopupTemplate是一个针对Layer和Graphic的弹窗,它与Popup最大的不同的是作用对象不同(Popup主要是针对View)。它服务的对象是Layer中的要素类或者Graphic,它能从要素中获取字段,并用HTML的语法显示到弹窗的content属性中去。