diff --git a/ArkUI/entry/src/main/ets/pages/CorrectWayToUseForEach.ets b/ArkUI/entry/src/main/ets/pages/CorrectWayToUseForEach.ets index 4e7e4be695ab03253bb2bb33ac949ba245ef7608..8b9f50d731e2fdb9efb6641b98306cd658696ef0 100644 --- a/ArkUI/entry/src/main/ets/pages/CorrectWayToUseForEach.ets +++ b/ArkUI/entry/src/main/ets/pages/CorrectWayToUseForEach.ets @@ -25,7 +25,6 @@ export struct BindSheetAndForEach { @State arr: number[] = [1, 2, 3, 4]; @State isHoverText: Array = new Array(this.arr.length).fill(false); - @Builder myBuilder() { Column() { @@ -36,7 +35,6 @@ export struct BindSheetAndForEach { .width('100%') } - build() { Column() { ForEach(this.arr, (item: number, idx: number) => { @@ -52,7 +50,7 @@ export struct BindSheetAndForEach { backgroundColor: Color.Gray, height: SheetSize.MEDIUM, showClose: true, - onDisappear: () => { + onWillDisappear: () => { this.isHoverText[idx] = false; } }) @@ -66,4 +64,5 @@ export struct BindSheetAndForEach { .height('100%') } } + // [End correct_way_to_use_forEach] \ No newline at end of file