當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。