文本类组件
2026年7月8日大约 3 分钟
文本类组件
用于展示标题、说明、数值文本与富文本内容。三者都支持绑定一个字段显示其首行值(动态文本)。
文本 basic-text
单行 / 多行文本,最常用的组件。可显示固定文案,或绑定字段显示动态值(如实时指标、标题)。默认尺寸 [300, 60]。
参数:
| option | 类型 | 默认 | 说明 |
|---|---|---|---|
text | string | 文本 | 固定文本内容 |
text-arrangement | select | horizontal | 排列:horizontal / vertical(竖排) |
content-overflow | select | hidden | 溢出:hidden 裁剪 / auto 滚动条(颜色跟随文字)。日志类长文本建议配合 text-vertical: top |
text-font | font | {size:20,color:'#fff'} | 字体(颜色 / 大小 / 粗体 / 斜体等) |
text-position | select | center | 水平对齐 left / center / right |
text-vertical | select | center | 垂直对齐 top / center / bottom |
font-spacing / text-indent | number | 0 | 字间距 / 首行缩进 |
发光 font-shadow-* | — | — | 文字发光(color / blur / offset-x / offset-y) |
投影 shadow-* | — | — | 文字投影 |
展示动画 animation-* | — | — | 滚动 / 闪烁等入场动画 |
数据绑定:
| 字段 | 约束 | 说明 |
|---|---|---|
value-field | string, 0~1 | 绑一个字段 → 显示其首行值,覆盖固定 text |
交互:通用触发器 click / mouseEnter / mouseLeave / appear;常配合 changeOption 动作(如点击改文案,公式 {:字段} 取 payload)。
{ "type": "basic-text", "uid": "w_kpi", "options": {
"position": [40, 40], "size": [360, 64],
"text-font": { "size": 40, "color": "#5cc8ff", "bold": true },
"value-field": [["conn_kpi", "tbl_kpi", "在线用户"]] } }段落 basic-paragraph
多段说明文字,适合较长的描述性内容。默认尺寸 [360, 200]。
参数:text(段落文本,双击可编辑)、font(字体,支持渐变 / 下划线)、font-line-height(行高 px)、text-indent(首行缩进,单位「字」)、text-position(对齐 left / center / right / justify)、text-padding(内边距 [左,右,上,下])、font-shadow-*(投影)、animation-*(滚动动画)。
数据绑定:value-field(string, 0~1)——用字段首行值作为内容。
Markdown basic-markdown
把 Markdown 源文本渲染为带样式的富文本(标题 / 列表 / 表格 / 代码高亮 / 引用 / 链接 / 图片),相当于 Markdown 预览。适合公告、说明、动态报告。默认尺寸 [360, 280]。
参数:
| option | 类型 | 默认 | 说明 |
|---|---|---|---|
content | string(textarea) | 示例 | Markdown 源文本(双击组件可编辑) |
md-theme | select | dark | 主题 dark / light |
md-overflow | select | auto | 溢出 auto(滚动) / hidden / visible |
text-font / font-line-height | font / number | 14 / 1.7 | 正文字体、行高倍数 |
text-align / text-padding | select / vector | left / [16,16,12,12] | 对齐、内边距 |
link-color / link-target-blank | color / boolean | #4aa3ff / true | 链接颜色、新窗口打开 |
highlight-code / linkify / breaks | boolean | true / true / false | 代码高亮 / 自动链接 / 单回车换行 |
allow-html | boolean | false | 允许内联 HTML(经 DOMPurify 清洗防 XSS) |
数据绑定:value-field(string, 0~1,用其首行值作为 Markdown 内容,覆盖 content)。
{ "type": "basic-markdown", "uid": "w_md", "options": {
"position": [40, 120], "size": [420, 300],
"content": "## 今日概览\n- 在线 **1286**\n- 告警 `2`",
"md-theme": "dark" } }