• geoscene/popup

content

AMD: require(["geoscene/popup/content"], (content) => { /* code goes here */ });
ESM: import * as content from "@geoscene/core/popup/content";
类: geoscene/popup/content
起始版本:GeoScene Maps SDK for JavaScript 4.11

这是一个在使用 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 RelationshipContent from "geoscene/popup/content/RelationshipContent";

您可以使用此模块在一行中导入它们:

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

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

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

function logContentElement(content: Content): void {
  if (content.type === "media") {
    console.log("Content type is media");
  }
  else {
    // The compiler knows the content element must be `text | fields | media | attachment | custom`
    console.log("The value is not a valid popup content element.")
  }
}

类型定义

AttachmentsContent AttachmentsContent

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

Popup 内容元素类型。

CustomContent CustomContent

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

ExpressionContent ExpressionContent

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

FieldsContent FieldsContent

FieldsContent 表示与要素关联的 FieldInfo

MediaContent MediaContent

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

RelationshipContent RelationshipContent

RelationshipContent 表示与要素关联的关系元素。

TextContent TextContent

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

您的浏览器不再受支持。请升级您的浏览器以获得最佳体验。请参阅浏览器弃用帖子以获取更多信息