Skip to content

Text 文本

基本用法

设置 text 设置文本内容。推荐您使用:text='value'的形式。

html
<wd-text text="只有拼尽全力,才能不留遗憾。只有奋斗不止,才能拥有更好的未来。"></wd-text>

设置主题

通过type参数设置文本主题,我们提供了五类属性:primary error success warning info-默认

html
<wd-text type="primary" text="主色"></wd-text>
<wd-text type="error"   text="错误"></wd-text>
<wd-text type="success" text="成功"></wd-text>
<wd-text type="warning" text="警告"></wd-text>
<wd-text text="默认"></wd-text>

自定义字体颜色

设置 color 属性。

html
<wd-text text="只有拼尽全力,才能不留遗憾。只有奋斗不止,才能拥有更好的未来。" color="#36B8C2"></wd-text>

是否粗体

设置 bold 属性。

html
<wd-text text="只有拼尽全力,才能不留遗憾。只有奋斗不止,才能拥有更好的未来。" bold></wd-text>

字体大小

设置 size 属性。

html
<wd-text text="只有拼尽全力,才能不留遗憾。只有奋斗不止,才能拥有更好的未来。" size="16px"></wd-text>

脱敏

设置 format 属性,当 modephone``name时生效。

html
<wd-text text="李四" mode="name" :format="true"></wd-text>
<wd-text text="张长三" mode="name" :format="true"></wd-text>
<wd-text text="18888888888" mode="phone" :format="true"></wd-text>

事件

html
<wd-text text="只有拼尽全力,才能不留遗憾。只有奋斗不止,才能拥有更好的未来。" @click="clickTest"></wd-text>
typescript
function clickTest(){
  console.log(1)
}

Attributes

参数说明类型可选值默认值最低版本
type主题类型string'primary' / 'error' / 'warning' / 'success'default-
text文字string--
size字体大小string---
mode文本处理的匹配模式string'text-普通文本' / 'date - 日期' / 'phone - 手机号' / 'name - 姓名'text-
bold是否粗体,默认normalboolean-false-
format是否脱敏boolean当mode为phone和name时生效false-
color文字颜色string---
lines文本显示的行数,如果设置,超出此行数,将会显示省略号。最大值为5。Number---
lineHeight文本行高string--

Events

事件名称说明参数最低版本
click标签点击时触发event-

Slots

外部样式类

类名说明最低版本
custom-class根节点样式-
custom-style根节点样式-

Released under the MIT License.

Released under the MIT License.