Presents texts. Its text content must be enclosed by tags, and can contain the escape character (\) .
Item | Description |
|---|---|
Applicable devices | Mobile phones, tablets, Vision products, and telematics devices |
Applicable regions | Global |
The active pseudo-class is supported. In addition to common styles, the styles listed in the following table are supported.
Style | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
lines | number | -1 | No | Number of text lines. The value -1 indicates that the number is not limited. |
color | color | rgba(0, 0, 0, 0.54) | No | Font color. |
letter-spacing (1020+) | number | 0 | No | Space between characters in a text. It is an exclusive extension attribute for quick apps for Huawei phones and is not defined in the specifications formulated by the vendor alliance. |
font-size | number | 30px | No | Font size. |
font-style | normal | italic | normal | No | Font style selected from the font family. |
font-weight | lighter | 100 | 200 | 300| 400 | 500 | 600 | 700 | 800| 900 | normal | bold | bolder | normal | No | Font weight. The default value is normal. |
text-decoration | underline | line-through | none | none | No | If the text-decoration attribute is used, you must assign a value to the value attribute. |
text-indent | length | percentage | cm | em | - | No | Indentation of the first line in a text block. |
text-align | left | center | right | left | No | Alignment direction of the text relative to its parent element. By default, multiple languages are supported. If the direction needs to be fixed, use this attribute together with the common attribute dir. |
line-height | length | - | No | Line height of the text. |
text-overflow | clip | ellipsis | clip | No | Takes effect when the number of lines is specified. |
font-family (1030+) | string | - | No | Font of strings in the element. Default fonts normal, sans-serif, serif, and monospace are supported, which are valid only for English strings. To customize fonts, please refer to font-face Style. |
<template>
<div class="container">
<div class="page-title-wrap">
<text class="page-title">{{componentName}}</text>
</div>
<div class="item-content">
<text class="hslbgcolor">hsla background-color</text>
<text class="item color-1">text-align:center</text>
<text class="item1 color-1">text-align:left</text>
<text class="item2 color-1">text-align:right</text>
</div>
<div class="item-content">
<text style="font-weight: bold;">text-font-weight-bold</text>
<text style="font-weight: bolder;">text-font-weight-bolder</text>
<text style="font-weight: lighter;">text-font-weight-lighter</text>
<text>text-font-weight-normal</text>
<text style="font-weight: 300;">text-font-weight-300</text>
<text style="font-weight: 400;">text-font-weight-400</text>
<text style="font-weight: 500;">text-font-weight-500</text>
<text style="font-weight: 900;">text-font-weight-900</text>
<text><span style="font-weight: bold;">font-weight-bold</span></text>
<text><span style="font-weight: bolder;">font-weight-bolder</span></text>
<text><span style="font-weight: 400;">font-weight-400</span></text>
<text><span style="font-weight: 500;">font-weight-500</span></text>
</div>
<div class="item-container">
<!-- style -->
<text class="item-title">lines: default -1</text>
<text class="txt">This framework is a framework for application development based on the front-end development technology stack. It adopts the popular front-end development model to fit the thinking habits of mainstream front-end developers, while greatly improving the performance of the application and providing a large number of systems that cannot be used in the front-end environment. Capabilities, as well as the ability to connect with many third-party services.</text>
<text class="item-title">lines:set as 3; text-overflow: clip</text>
<text class="txt" style="lines: 3;">This framework is a framework for application development based on the front-end development technology stack. It adopts the popular front-end development model to fit the thinking habits of mainstream front-end developers, while greatly improving the performance of the application and providing a large number of systems that cannot be used in the front-end environment. Capabilities, as well as the ability to connect with many third-party services.</text>
<text class="item-title">lines:set as 3; text-overflow: ellipsis</text>
<text class="txt" style="lines: 3; text-overflow: ellipsis;">This framework is a framework for application development based on the front-end development technology stack. It adopts the popular front-end development model to fit the thinking habits of mainstream front-end developers, while greatly improving the performance of the application and providing a large number of systems that cannot be used in the front-end environment. Capabilities, as well as the ability to connect with many third-party services.</text>
<text class="item-title">line-height:set as 50px</text>
<text class="txt" style="line-height: 50px;">This framework is a framework for application development based on the front-end development technology stack. It adopts the popular front-end development model to fit the thinking habits of mainstream front-end developers, while greatly improving the performance of the application and providing a large number of systems that cannot be used in the front-end environment. Capabilities, as well as the ability to connect with many third-party services.</text>
<text class="item-letterspacing" style="line-height: 50px;">letter spacing</text>
</div>
<div class="item-container">
<text>abcdefghijklmn</text>
<text style="text-indent: 100px">abcdefghijklmn</text>
<text style="text-indent: 3cm">abcdefghijklmn</text>
<text style="text-indent: 4em">abcdefghijklmn</text>
<text style="text-indent: 20%">abcdefghijklmn</text>
</div>
</div>
</template>
<style>
.container {
flex: 1;
flex-direction: column;
}
.page-title-wrap {
padding-top: 50px;
padding-bottom: 80px;
justify-content: center;
}
.page-title {
padding-top: 30px;
padding-bottom: 30px;
padding-left: 40px;
padding-right: 40px;
border-color: #bbbbbb;
color: #bbbbbb;
border-bottom-width: 2px;
}
.hslbgcolor {
text-align: center;
background-color: hsla(360, 50%, 50%, 0.5);
}
.item-container {
margin-bottom: 50px;
margin-right: 60px;
margin-left: 60px;
flex-direction: column;
}
.item-title {
padding-top: 50px;
padding-bottom: 20px;
color: #aaaaaa;
}
.item-content {
flex-direction: column;
margin-right: 60px;
margin-left: 60px;
}
.item {
height: 150px;
width: 550px;
text-align: center;
}
.item1 {
height: 150px;
width: 550px;
}
.item2 {
height: 150px;
width: 550px;
text-align: right;
}
.item-letterspacing {
font-size: 30px;
letter-spacing: 30px;
}
.color-1 {
background-color: #09ba07;
}
</style>
<script>
export default {
data: {
componentName: 'text'
},
onInit() {
this.$page.setTitleBar({ text: 'text' })
}
}
</script> The following figure shows the final effect.

Version | Date | Description |
|---|---|---|
1030 | 2018-10-31 |
|
1020 | 2018-06-20 | Added the setting of the letter-spacing style. |
1010 | 2018-04-20 | Added the support for the active pseudo-class. |