Text 文本
用于展示文本。
基础用法
使用 type 属性定义文本类型。
DefaultPrimarySuccessInfoWarningDanger
尺寸
使用 size 属性设置尺寸,可选 large、default 或 small。
LargeDefaultSmall
省略
传入 truncated 在文本超出视口或所设最大宽度时显示省略号。使用 line-clamp 实现多行省略。自 0.1.17 起暴露 isTruncated,表示文本当前是否被截断。
Self element set width 100px
Squeezed by parent element
The -webkit-line-clamp CSS property
allows limiting of the contents of
a block to the specified number of lines.
allows limiting of the contents of
a block to the specified number of lines.
Show tooltip only when the text is truncated
isTruncated: false
覆盖元素
使用 tag 属性覆盖渲染的元素标签。
span
This is a paragraph.
Bold
Italic
This is subscript
This is superscript
Inserted
Marked
混合内容
文本与其他组件混合展示。
Element-Plus
Rate
This is text mixed icon and component
API
属性
| 名称 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| type | 文本类型 | enum | — |
| size | 文本尺寸 | enum | default |
| truncated | 是否显示省略号 | boolean | false |
| line-clamp | 最大行数 | string / number | — |
| tag | 自定义元素标签 | string | span |
插槽
| 名称 | 说明 |
|---|---|
| default | 默认内容 |
暴露
| 名称 | 说明 | 类型 |
|---|---|---|
| isTruncated 0.1.17 | 文本当前是否被截断 | object |
| updateTooltip | 手动更新 Tooltip 状态 | Function |