当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


JavaScript ArcGIS TextContent用法及代码示例


基本信息

以下是所在类或对象的基本信息。

AMD: require(["esri/popup/content/TextContent"], (TextContent) => { /* code goes here */ });

ESM: import TextContent from "@arcgis/core/popup/content/TextContent";

类: esri/popup/content/TextContent

继承: TextContent > Content > Accessor

自从:用于 JavaScript 4.11 的 ArcGIS API

用法说明

TextContent 弹出元素用于将说明性文本定义为 PopupTemplate's 内容中的元素。文本可以引用从字段属性返回的值或在 PopupTemplate 的 expressionInfos 属性中定义的 Arcade 表达式。

popuptemplate-text-element.

例子:

// Create the Text Content Element
// This element uses an attribute from the featurelayer which displays a sentence
// giving the total amount of trees value within a specified census block.
let textElement = new TextContent();
textElement.text = "There are {Point_Count} trees within census block {BLOCKCE10}";

// // Create the PopupTemplate
let template = new PopupTemplate({
  title: "Beverly Hills trees by block",
  outFields: ["*"],
  content: [textElement]
});
layer.popupTemplate = {
  content: [{
    type: "text", // Autocasts as new TextContent
    text: "The {expression/predominance-tree} species occurs more often"
      + " than other tree species in the area."
  }]
};

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 TextContent。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。