diff --git a/en/application-dev/reference/arkui-ts/figures/richText.png b/en/application-dev/reference/arkui-ts/figures/richText.png index 65826de750d037a394178b66805a9d1ffdad374e..d7ae9f6dfaa45c77143700a24addf29371c7cc38 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/richText.png and b/en/application-dev/reference/arkui-ts/figures/richText.png differ diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md b/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md index a2c0c6b009bbdf962c59e577ee41fa70e8dda3de..b001bea074179694551c8328c076efb2a8968f6e 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md @@ -31,6 +31,10 @@ RichText(content:string) | onStart(callback: () => void) | Triggered when web page loading starts. | | onComplete(callback: () => void) | Triggered when web page loading is completed.| +## Attributes + +Among the [universal attributes](ts-universal-attributes-size.md), only the **width**, **height**, **size**, and **layoutWeight** attributes are supported. + ## Supported Tags | Name| Description| Example| @@ -39,13 +43,13 @@ RichText(content:string) | \
\
| Defines a paragraph.| \This is a paragraph\
| | \This is a paragraph\
This is a new paragraph\
This is a paragraph\
\This is a paragraph\
| +| \This is text\
\This is text\
| | \\This is an underlined paragraph\\
| | \ | Used to embed CSS within an HTML document.| \ | -| style | Defines the inline style of an element and is placed inside the tag. Use quotation marks (') to separate the styling text and use semicolons (;) to separate styles, for example, **style='width: 500px;height: 500px;border: 1px solid;margin: 0 auto;'**.| \This is a paragraph\
| +| style | Defines the inline style of an element and is placed inside the tag. Use quotation marks (') to separate the styling text and use semicolons (;) to separate styles, for example, **style='width: 500px;height: 500px;border: 1px solid;margin: 0 auto;'**.| \This is text\
| | \ | Embeds or references a client-side script, such as JavaScript.| \ | ## Example @@ -66,7 +70,7 @@ struct RichTextExample { 'Font size: 35px; line height: 45px
' + '' + - '
This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.
'; + 'This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text.
'; build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, @@ -78,6 +82,29 @@ struct RichTextExample { .onComplete(() => { console.info('RichText onComplete'); }) + .width(500) + .height(400) + .backgroundColor(0XBDDB69) + RichText('layoutWeight(1)') + .onStart(() => { + console.info('RichText onStart'); + }) + .onComplete(() => { + console.info('RichText onComplete'); + }) + .size({ width: '100%', height: 110 }) + .backgroundColor(0X92D6CC) + .layoutWeight(1) + RichText('layoutWeight(2)') + .onStart(() => { + console.info('RichText onStart'); + }) + .onComplete(() => { + console.info('RichText onComplete'); + }) + .size({ width: '100%', height: 110 }) + .backgroundColor(0X92C48D) + .layoutWeight(2) } } }