未验证 提交 b56ed38f 编写于 作者: 1 189******51 提交者: Gitee

IssueNo: #I7XVG3:[新需求]: Rectify the arkts syntax 3

Description: Rectify the arkts syntax in arkts-prop.md.
Sig: SIG_ApplicaitonFramework
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: N189******51 <lipeicheng5@huawei.com>
上级 5a8241f5
...@@ -264,7 +264,7 @@ struct ParentComponent { ...@@ -264,7 +264,7 @@ struct ParentComponent {
```ts ```ts
@Component @Component
struct Child { struct Child {
@Prop value: number; @Prop value: number = 0;
build() { build() {
Text(`${this.value}`) Text(`${this.value}`)
...@@ -288,10 +288,10 @@ struct Index { ...@@ -288,10 +288,10 @@ struct Index {
Divider().height(5) Divider().height(5)
ForEach(this.arr, ForEach(this.arr,
item => { (item: void) => {
Child({value: item}) Child({value: item})
}, },
item => item.toString() (item: string) => item.toString()
) )
Text('replace entire arr') Text('replace entire arr')
.fontSize(50) .fontSize(50)
...@@ -419,7 +419,7 @@ class Book { ...@@ -419,7 +419,7 @@ class Book {
@Component @Component
struct ReaderComp { struct ReaderComp {
@Prop book: Book; @Prop book: Book = new Book();
build() { build() {
Row() { Row() {
...@@ -442,10 +442,10 @@ struct Library { ...@@ -442,10 +442,10 @@ struct Library {
ReaderComp({ book: this.allBooks[2] }) ReaderComp({ book: this.allBooks[2] })
Divider() Divider()
Text('Books on loaan to a reader') Text('Books on loaan to a reader')
ForEach(this.allBooks, book => { ForEach(this.allBooks, (book: void) => {
ReaderComp({ book: book }) ReaderComp({ book: book })
}, },
book => book.id) (book: number): number => book.id)
Button('Add new') Button('Add new')
.onClick(() => { .onClick(() => {
this.allBooks.push(new Book("The C++ Standard Library", 512)); this.allBooks.push(new Book("The C++ Standard Library", 512));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册