# generaltranslation: General Translation Core SDK: JsxChildren URL: https://generaltranslation.com/zh/docs/core/types/jsx-children.mdx --- title: JsxChildren description: 可翻译并渲染的 JSX 内容类型定义 --- ## 概述 `JsxChildren` 表示包含文本、元素和变量的 JSX 内容,可用于翻译。 ```typescript type JsxChildren = JsxChild | JsxChild[]; ``` ## 结构 ```typescript type JsxChild = string | JsxElement | Variable; ``` | 类型 | 描述 | | ------------ | ----- | | `string` | 纯文本内容 | | `JsxElement` | 结构化元素 | | `Variable` | 动态占位符 | ### JsxElement ```typescript type JsxElement = { t?: string; // 标签名 i?: number; // id d?: GTProp; // GT 属性 c?: JsxChildren; // 子节点 }; ``` ## 示例 ### 基本用法 ```typescript copy import { JsxChildren, Variable } from 'generaltranslation'; // 简单文本 const text: JsxChildren = "Welcome!"; // 带变量的文本 const greeting: JsxChildren = [ "Hello, ", { k: 'userName' } as Variable, "!" ]; ``` ### 结构化元素 ```typescript copy // Div 元素 const divElement: JsxChildren = { t: 'div', c: ['Content here'] }; // 带标题的链接 const linkElement: JsxChildren = { t: 'a', d: { ti: 'Visit homepage' }, c: ['Click here'] }; ``` ## 相关类型 * [`JsxChild`](/docs/core/types/jsx-child) - 单个子节点类型 * [`JsxElement`](/docs/core/types/jsx-element) - 结构化元素定义