-
sources
Collection<SearchSource>
autocast
搜索微件可用于搜索 map /feature 服务要素图层、SceneLayers 与关联要素图层、BuildingComponentSublayer 与关联要素图层、GeoJSONLayer、CSVLayer 中的要素。或 OGCFeatureLayer 、 table 或带有 locator 的地理编码位置。
sources
属性定义搜索“搜索”小部件实例指定的视图的源。有两种类型的来源:这些来源的任何组合都可以在 Search 小部件的同一实例中一起使用。
不支持从客户端图形创建的要素图层。
例子:
// Default sources[] when sources is not specified [ { url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer", singleLineFieldName: "SingleLine", outFields: ["Addr_type"], name: "ArcGIS World Geocoding Service", placeholder: "Address", resultSymbol: { type: "picture-marker", // autocasts as new PictureMarkerSymbol() url: this.basePath + "/images/search/search-symbol-32.png", size: 24, width: 24, height: 24, xoffset: 0, yoffset: 0 } } ]
// Example of multiple sources[] const sources = [ { url: "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer", singleLineFieldName: "SingleLine", name: "Custom Geocoding Service", placeholder: "Search Geocoder", maxResults: 3, maxSuggestions: 6, suggestionsEnabled: false, minSuggestCharacters: 0 }, { layer: new FeatureLayer({ url: "https://services.arcgis.com/DO4gTjwJVIJ7O9Ca/arcgis/rest/services/GeoForm_Survey_v11_live/FeatureServer/0", outFields: ["*"] }), searchFields: ["Email", "URL"], displayField: "Email", exactMatch: false, outFields: ["*"], name: "Point FS", placeholder: "example: esri", maxResults: 6, maxSuggestions: 6, suggestionsEnabled: true, minSuggestCharacters: 0 }, { layer: new FeatureLayer({ outFields: ["*"] }), placeholder: "esri", name: "A FeatureLayer", prefix: "", suffix: "", maxResults: 1, maxSuggestions: 6, exactMatch: false, searchFields: [], // defaults to FeatureLayer.displayField displayField: "", // defaults to FeatureLayer.displayField minSuggestCharacters: 0 } ];
// Set source(s) on creation const searchWidget = new Search({ sources: [] });
// Set source(s) const searchWidget = new Search(); const sources = [{ ... }, { ... }, { ... }]; //array of sources searchWidget.sources = sources;
// Add to source(s) const searchWidget = new Search(); searchWidget.sources.push({ ... }); //new source
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/widgets/Search"], (Search) => { /* code goes here */ });
ESM:
import Search from "@arcgis/core/widgets/Search";
类:
esri/widgets/Search
继承: Search > Widget > Accessor
自从:用于 JavaScript 4.0 的 ArcGIS API
用法说明
Search.sources
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS Search.classes用法及代码示例
- JavaScript ArcGIS Search.container用法及代码示例
- JavaScript ArcGIS Search.when用法及代码示例
- JavaScript ArcGIS Search.includeDefaultSources用法及代码示例
- JavaScript ArcGIS Search.on用法及代码示例
- JavaScript ArcGIS Search.goToOverride用法及代码示例
- JavaScript ArcGIS Search.visible用法及代码示例
- JavaScript ArcGIS Search用法及代码示例
- JavaScript ArcGIS Search search-clear事件用法及代码示例
- JavaScript ArcGIS Search select-result事件用法及代码示例
- JavaScript ArcGIS Search suggest-start事件用法及代码示例
- JavaScript ArcGIS Search search-focus事件用法及代码示例
- JavaScript ArcGIS Search search-start事件用法及代码示例
- JavaScript ArcGIS Search search-complete事件用法及代码示例
- JavaScript ArcGIS Search search-blur事件用法及代码示例
- JavaScript ArcGIS Search suggest-complete事件用法及代码示例
- JavaScript Set add()用法及代码示例
- JavaScript ArcGIS ServiceAreaParameters.apiKey用法及代码示例
- JavaScript ArcGIS SegmentDrawAction draw-complete事件用法及代码示例
- JavaScript Set.add()用法及代码示例
- JavaScript ArcGIS SegmentDrawAction cursor-update事件用法及代码示例
- JavaScript ArcGIS SegmentDrawAction.on用法及代码示例
- JavaScript ArcGIS ServerInfo.hasServer用法及代码示例
- JavaScript Set delete()用法及代码示例
- JavaScript Set forEach()用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 Search.sources。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。