TAYUN 9132174b11
docs: ✏️ 修复基础组件文档问题 - 阶段一完成 (#1220)
* docs(button): 更新按钮组件文档对开放能力的描述

- 修改 session-message-title 和 session-message-path 属性名称
- 新增 chooseavatar 和 agreeprivacyauthorization 事件回调

* docs(icon): 更新图标组件文档

- 调整属性描述,明确 name 属性可用于图标名称或图片链接
- 添加事件列表,明确 click 事件的参数
- 移除英文示例代码中不必要的示例和图标列表
- 优化文档结构和格式,使信息更加清晰

* docs(config-provider): 更新全局配置组件文档

- 调整文档中的强调样式,使用加粗替代下划线
- 完善英文文档缺失的内容,保持和中文文档一致

* docs(component): 更新 Popup 组件文档

- 调整文档结构,优化标题层级
- 添加 v-model 使用示例,明确组件绑定值
- 移除冗余的代码示例,精简文档内容
- 更新属性表格,统一属性描述
- 添加防止滚动穿透的解决方案说明

* docs(resize):  ✏️ 更新 resize 组件文档

- 修正事件名称从 `size` 改为 `resize`
- 添加组件属性(Attributes)、事件(Events)和插槽(Slots)的详细说明
- 更新文档结构,使其更加完整和易于理解

* docs(transition): ✏️完善Transition 动画组件文档的属性和事件描述

- 增加自定义根节点样式类、懒渲染、动画结束后销毁子节点等属性
- 添加进入和离开过渡的开始、激活和结束状态类
- 新增点击事件和默认插槽
- 更新文档以反映新增功能

* docs(fab): ✏️更新fab组件文档

- 优化了文档结构,调整了部分格式
- 添加了 Methods 和 default Slot 相关的信息
- 更新了 custom-style 属性的命名

* docs(component): ✏️ 更新 Text 组件文档

- 优化文档格式,调整表格结构
- 添加缺失的参数说明和示例代码
- 更新参数类型和默认值
- 增加 call 参数说明
- 补充 Slots 表格

* docs(root-portal):  ✏️ 更新组件文档

- 添加 Attributes 和 Events 部分,说明该组件无相关配置
- 修正 Slots 部分的版本信息,统一为 1.11.0
- 更新中文和英文文档
2025-08-17 14:08:48 +08:00

6.2 KiB

Text

Text component, used to display text information.

Available since version 1.3.4

Basic Usage

Set text to set the text content. It is recommended to use the form :text='value'.

<wd-text
  text="Reed leaves fill the sandbar, cold sand carries shallow streams. Twenty years later, passing the south tower again. The boat tied under willows is not yet steady, how many days until mid-autumn comes again? Yellow crane at the broken cliff, has my old friend been here? The old rivers and mountains are all filled with new sorrows. Wanting to buy osmanthus flowers and bring wine, but it's never like the wanderings of youth."
></wd-text>

Set Theme

Set text theme through the type parameter. We provide five types: primary error success warning default.

<wd-text type="primary" text="Primary"></wd-text>
<wd-text type="error" text="Error"></wd-text>
<wd-text type="success" text="Success"></wd-text>
<wd-text type="warning" text="Warning"></wd-text>
<wd-text text="Default"></wd-text>

Custom Font Color

Set the color property.

<wd-text
  text="Reed leaves fill the sandbar, cold sand carries shallow streams. Twenty years later, passing the south tower again. The boat tied under willows is not yet steady, how many days until mid-autumn comes again? Yellow crane at the broken cliff, has my old friend been here? The old rivers and mountains are all filled with new sorrows. Wanting to buy osmanthus flowers and bring wine, but it's never like the wanderings of youth."
  color="#36B8C2"
></wd-text>

Bold Text

Set the bold property.

<wd-text
  text="Reed leaves fill the sandbar, cold sand carries shallow streams. Twenty years later, passing the south tower again. The boat tied under willows is not yet steady, how many days until mid-autumn comes again? Yellow crane at the broken cliff, has my old friend been here? The old rivers and mountains are all filled with new sorrows. Wanting to buy osmanthus flowers and bring wine, but it's never like the wanderings of youth."
  bold
></wd-text>

Font Size

Set the size property.

<wd-text
  text="Reed leaves fill the sandbar, cold sand carries shallow streams. Twenty years later, passing the south tower again. The boat tied under willows is not yet steady, how many days until mid-autumn comes again? Yellow crane at the broken cliff, has my old friend been here? The old rivers and mountains are all filled with new sorrows. Wanting to buy osmanthus flowers and bring wine, but it's never like the wanderings of youth."
  size="16px"
></wd-text>

Data Masking

Set the format property, effective when mode is phone or name.

<wd-text text="Li Si" mode="name" :format="true"></wd-text>
<wd-text text="Zhang Chang San" mode="name" :format="true"></wd-text>
<wd-text text="18888888888" mode="phone" :format="true"></wd-text>

Lines

Set the lines property to specify the number of lines of text to display. If set, an ellipsis will be shown when the text exceeds this number of lines. Maximum value is 5.

<wd-text :text="text" :lines="2" size="16px"></wd-text>

Line Height

Set lineHeight for text line height.

<wd-text :text="text" lineHeight="20px"></wd-text>

Prefix and Suffix Slots

Set prefix and suffix slots.

<wd-text
  text="12345678901"
  mode="phone"
  format
  type="primary"
  prefix="Prefix"
  suffix="Suffix"
/>

<wd-text text="12345678901" mode="phone" format type="primary">
  <template #prefix>
    <text>Prefix</text>
  </template>
  <template #suffix>Suffix</template>
</wd-text>

Price

Set mode="price".

<wd-text
  text="16354.156"
  mode="price"
  type="success"
  decoration="line-through"
  prefix="¥"
/>

Text Decoration

Set decoration for text decoration, such as underline, line-through, etc.

<wd-text :text="text" type="warning" decoration="underline"/>

Events

<wd-text
  text="Reed leaves fill the sandbar, cold sand carries shallow streams. Twenty years later, passing the south tower again. The boat tied under willows is not yet steady, how many days until mid-autumn comes again? Yellow crane at the broken cliff, has my old friend been here? The old rivers and mountains are all filled with new sorrows. Wanting to buy osmanthus flowers and bring wine, but it's never like the wanderings of youth."
  @click="clickTest"
></wd-text>
function clickTest() {
  console.log(1)
}

Attributes

Parameter Description Type Options Default Version
type Theme type string 'primary' / 'error' / 'warning' / 'success' / 'default' default 1.3.4
text Text content string / number - - 1.3.4
size Font size string - - 1.3.4
mode Text processing mode string 'text' / 'date' / 'phone' / 'name' / 'price' text 1.3.4+
bold Whether bold, default normal boolean - false 1.3.4
format Whether to mask data boolean Effective when mode is phone or name false 1.3.4
color Text color string - - 1.3.4
lines Number of lines to display, if set, ellipsis will show when exceeding. Max value is 5. number - - 1.3.4
lineHeight Text line height string - - 1.3.4
decoration Text decoration, underline, line-through, etc. string 'underline' / 'line-through' / 'overline' none 1.3.4+
prefix Prefix content string - - 1.3.4+
suffix Suffix content string - - 1.3.4+
call Whether to make a call when clicking text in phone mode boolean - false 1.3.4

Events

Event Name Description Parameters Version
click Triggered when text is clicked event 1.3.4

Slots

Slot Name Description Version
prefix Prefix slot 1.3.4
suffix Suffix slot 1.3.4

External Classes

Class Name Description Version
custom-class Root node style 1.3.4
custom-style Root node style 1.3.4