From 1599fe90180cafd4db26d79935ee90b12095d6ae Mon Sep 17 00:00:00 2001 From: "ester.zhou" Date: Fri, 9 Sep 2022 17:26:42 +0800 Subject: [PATCH] update doc (8462) Signed-off-by: ester.zhou --- .../ui/ts-other-states-consume-provide.md | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/en/application-dev/ui/ts-other-states-consume-provide.md b/en/application-dev/ui/ts-other-states-consume-provide.md index f501dca6e2..4d238cc188 100644 --- a/en/application-dev/ui/ts-other-states-consume-provide.md +++ b/en/application-dev/ui/ts-other-states-consume-provide.md @@ -11,7 +11,7 @@ Table 1 @Provide | Decorator parameter | A constant of the string type, which is used to set an alias for a decorated variable. If an alias is specified, implement the data update for this alias. If there is no alias, use the variable name as the alias. @Provide("_alias_") is recommended. | | Synchronization mechanism | The @Provide decorated variable is similar to the @state variable. You can modify the variable to re-render the page. You can also modify the @Consume decorated variable to modify the @State decorated variable reversely. | | Initial value | The initial value must be set. | -| Page re-rendering scenarios | The following will trigger page re-rendering:
- Changes of variables in primitive types (boolean, string, and number)
- Changes of the @Observed decorated classes or their attributes
- Adding, deleting, or updatingelements in an array | +| Page re-rendering scenarios | The following will trigger page re-rendering:
- Changes of variables in primitive types (boolean, string, and number)
- Changes of the @Observed decorated classes or their attributes
- Adding, deleting, or updating elements in an array | Table 2 @Consume @@ -34,44 +34,44 @@ The description of other attributes is the same as that of @Provide. @Entry @Component struct CompA { - @Provide("reviewVote") reviewVotes : number = 0; - - build() { - Column() { - CompB() - Button() { - Text(`${this.reviewVotes}`) - .fontSize(30) - } - .onClick(() => { - this.reviewVotes += 1; - }) - } + @Provide("reviewVote") reviewVotes : number = 0; + + build() { + Column() { + CompB() + Button() { + Text(`${this.reviewVotes}`) + .fontSize(30) + } + .onClick(() => { + this.reviewVotes += 1; + }) } + } } @Component struct CompB { - build() { - Column() { - CompC() - } + build() { + Column() { + CompC() } + } } @Component struct CompC { - @Consume("reviewVote") reviewVotes : number; - build() { - Column() { - Button() { - Text(`${this.reviewVotes}`) - .fontSize(30) - } - .onClick(() => { - this.reviewVotes += 1; - }) - } + @Consume("reviewVote") reviewVotes : number; + build() { + Column() { + Button() { + Text(`${this.reviewVotes}`) + .fontSize(30) + } + .onClick(() => { + this.reviewVotes += 1; + }) } + } } ``` -- GitLab