WText 文本组件
文本组件,基于 WinDesignNext WText 封装,用于渲染带样式的文本内容。
基础用法
V0.9 标准格式
json
{
"id": "text_001",
"component": "WText",
"text": "文本内容",
"type": "primary",
"size": "default"
}| 属性 | 类型 | 说明 |
|---|---|---|
id | string | 组件唯一标识 |
component | string | 固定值 WText |
text | string | { literalString: string } | 文本内容 |
type | string | 文本类型/颜色 |
size | string | 文本尺寸 |
truncated | boolean | 是否显示省略号 |
lineClamp | number | string | 最大行数(多行省略) |
tag | string | 自定义 HTML 标签 |
fontWeight | string | number | 字体粗细,如 'bold'、700 等 |
path 支持说明
通用绑定格式见 path 数据绑定速查。
| 属性 | 支持 path | 说明 |
|---|---|---|
text | ✅ | 文本内容(dataModel 路径或 @row.xxx) |
type | ✅ | 文本颜色/类型样式 |
size / truncated 等 | ❌ | 静态配置 |
绑定示例:
json
{
"text": { "path": "/userName" },
"type": "primary"
}使用示例
不同尺寸
json
{
"id": "text_large",
"component": "WText",
"text": "大号文本",
"size": "large"
}自定义字体粗细
json
{
"id": "text_bold",
"component": "WText",
"text": "加粗文本",
"fontWeight": 700
}