diff --git a/en/application-dev/reference/arkui-ts/ts-container-griditem.md b/en/application-dev/reference/arkui-ts/ts-container-griditem.md index f5d0820467b44a515181c2e9a5cf3eb51e23079a..ca8e19332e7c8eb573c9086b25ec455a573ed5f0 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-griditem.md +++ b/en/application-dev/reference/arkui-ts/ts-container-griditem.md @@ -25,7 +25,7 @@ GridItem() | rowEnd | number | End row number of the component.| | columnStart | number | Start column number of the component.| | columnEnd | number | End column number of the component.| -| forceRebuild | boolean | Whether to re-create the component when it is being built.
Default value: **false**| +| forceRebuild(deprecated) | boolean | Whether to re-create the component when it is being built.
This API is deprecated since API version 9. Whether to re-create the component is automatically determined based on the component attributes and child component changes. No manual configuration is required.
Default value: **false**| | selectable8+ | boolean | Whether the current grid item is selectable by the mouse.
> **NOTE**
> This attribute takes effect only when mouse frame selection is enabled for the parent **\** container.
Default value: **true**| @@ -43,29 +43,40 @@ GridItem() @Entry @Component struct GridItemExample { - @State numbers: string[] = Array.apply(null, Array(16)).map(function (item, i) { return i.toString() }) + @State numbers: string[] = Array.apply(null, { length: 16 }).map(function (item, i) { + return i.toString() + }) build() { Column() { Grid() { GridItem() { Text('4') - .fontSize(16).backgroundColor(0xFAEEE0) - .width('100%').height('100%').textAlign(TextAlign.Center) + .fontSize(16) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) }.rowStart(1).rowEnd(4) ForEach(this.numbers, (item) => { GridItem() { Text(item) - .fontSize(16).backgroundColor(0xF9CF93) - .width('100%').height('100%').textAlign(TextAlign.Center) - }.forceRebuild(false) + .fontSize(16) + .backgroundColor(0xF9CF93) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + } }, item => item) GridItem() { Text('5') - .fontSize(16).backgroundColor(0xDBD0C0) - .width('100%').height('100%').textAlign(TextAlign.Center) + .fontSize(16) + .backgroundColor(0xDBD0C0) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) }.columnStart(1).columnEnd(5) } .columnsTemplate('1fr 1fr 1fr 1fr 1fr')