未验证 提交 1d7b4507 编写于 作者: O openharmony_ci 提交者: Gitee

!15167 翻译完成 14462:废弃GridItem的forceRebuild属性

Merge pull request !15167 from ester.zhou/TR-14462
...@@ -25,7 +25,7 @@ GridItem() ...@@ -25,7 +25,7 @@ GridItem()
| rowEnd | number | End row number of the component.| | rowEnd | number | End row number of the component.|
| columnStart | number | Start column number of the component.| | columnStart | number | Start column number of the component.|
| columnEnd | number | End 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.<br>Default value: **false**| | forceRebuild<sup>(deprecated)</sup> | boolean | Whether to re-create the component when it is being built.<br>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.<br>Default value: **false**|
| selectable<sup>8+</sup> | boolean | Whether the current grid item is selectable by the mouse.<br>> **NOTE**<br>> This attribute takes effect only when mouse frame selection is enabled for the parent **\<Grid>** container.<br>Default value: **true**| | selectable<sup>8+</sup> | boolean | Whether the current grid item is selectable by the mouse.<br>> **NOTE**<br>> This attribute takes effect only when mouse frame selection is enabled for the parent **\<Grid>** container.<br>Default value: **true**|
...@@ -43,29 +43,40 @@ GridItem() ...@@ -43,29 +43,40 @@ GridItem()
@Entry @Entry
@Component @Component
struct GridItemExample { 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() { build() {
Column() { Column() {
Grid() { Grid() {
GridItem() { GridItem() {
Text('4') Text('4')
.fontSize(16).backgroundColor(0xFAEEE0) .fontSize(16)
.width('100%').height('100%').textAlign(TextAlign.Center) .backgroundColor(0xFAEEE0)
.width('100%')
.height('100%')
.textAlign(TextAlign.Center)
}.rowStart(1).rowEnd(4) }.rowStart(1).rowEnd(4)
ForEach(this.numbers, (item) => { ForEach(this.numbers, (item) => {
GridItem() { GridItem() {
Text(item) Text(item)
.fontSize(16).backgroundColor(0xF9CF93) .fontSize(16)
.width('100%').height('100%').textAlign(TextAlign.Center) .backgroundColor(0xF9CF93)
}.forceRebuild(false) .width('100%')
.height('100%')
.textAlign(TextAlign.Center)
}
}, item => item) }, item => item)
GridItem() { GridItem() {
Text('5') Text('5')
.fontSize(16).backgroundColor(0xDBD0C0) .fontSize(16)
.width('100%').height('100%').textAlign(TextAlign.Center) .backgroundColor(0xDBD0C0)
.width('100%')
.height('100%')
.textAlign(TextAlign.Center)
}.columnStart(1).columnEnd(5) }.columnStart(1).columnEnd(5)
} }
.columnsTemplate('1fr 1fr 1fr 1fr 1fr') .columnsTemplate('1fr 1fr 1fr 1fr 1fr')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册