目录

text

Represents the text.

Since: 1.0.0

Constraints

Only text components can be nested within the text component; nesting other components is ineffective.

Properties

Name

Type

Default Value

Mandatory

Description

user-select

boolean

false

No

Whether it is selectable.

space

string

emsp

No

How consecutive spaces are rendered. Valid values:

  • nbsp: non-breaking space with the font-dependent width.
  • ensp: half-width Chinese space.
  • emsp: full-width Chinese space.

If a value other than the above is set, the component will directly display the spaces entered by the developer.

decode

boolean

false

No

Whether to decode. For example, &lt; will be displayed as <.

Values can be parsed: &apos;, &gt;, &lt;, &amp;, &ensp;, &emsp;, and &nbsp;.

Example

<view>
  <view class="text-box">
    <text user-select="{{true}}">This is a piece of text that can be selected.</text>
  </view>
  <view class="text-box">
    <text space="ensp">This is an ensp space.</text>
  </view>
  <view class="text-box">
    <text space="emsp">This is an emsp space.</text>
  </view>
  <view class="text-box">
    <text space="nbsp">This is a nbsp space.</text>
  </view>
</view>