content

AMD: require(["geoscene/popup/content"], (content) => { /* 代码 */ });
ESM: import * as content from "@geoscene/core/popup/content";
Object: geoscene/popup/content
起始版本: GeoScene API for JavaScript 4.22

在使用 TypeScript 开发时,导入 Content 类很方便但不要像这样一次导入一个内容元素:

import TextContent from "geoscene/popup/content/TextContent";
import MediaContent from "geoscene/popup/content/MediaContent";
import FieldsContent from "geoscene/popup/content/FieldsContent";
import AttachmentsContent from "geoscene/popup/content/AttachmentsContent";
import CustomContent from "geoscene/popup/content/CustomContent";
import ExpressionContent from "geoscene/popup/content/ExpressionContent";

您可以使用单行导入此模块的内容:

import { TextContent, MediaContent, FieldsContent, AttachmentsContent, CustomContent, ExpressionContent } from "geoscene/popup/content";

此模块还允许您在内容元素上实现 类型保护,使代码更智能。

import { Content } from "geoscene/popup/content";

function logContentElement(content: Content): void {
  if (content.type === "media") {
    console.log("内容是媒体");
  }
  else {
    // 编译器识别内容必须是 `text | fields | media | attachment | custom`
    console.log("弹出框内容无效!")
  }
}

类型定义

AttachmentsContent AttachmentsContent

AttachmentsContent 表示与要素关联的附件元素。

Popup 内容元素类型.

CustomContent CustomContent

CustomContent 表示与要素关联的自定义内容元素。

ExpressionContent ExpressionContent

ExpressionContent 表示与要素关联的表达式元素。

FieldsContent FieldsContent

FieldsContent 表示与功能关联的 FieldInfo

MediaContent MediaContent

MediaContent 包含要在弹出窗口内容中显示的单个或一组图表和/或图像媒体元素。

TextContent TextContent

TextContent 将描述性文本定义为 PopupTemplate 中的元素。

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.