修改异常恢复后state变量无法刷新问题

Signed-off-by: zhengwest <zhengxi5@huawei.com>
This commit is contained in:
zhengwest 2024-10-22 19:32:33 +08:00
parent de83afca45
commit 5c3321ae05
5 changed files with 18 additions and 19 deletions

View File

@ -76,7 +76,7 @@ export default class EntryAbility extends UIAbility {
}
onSaveState(reason: AbilityConstant.StateType, wantParam: Record<string, Object>): AbilityConstant.OnSaveResult {
Logger.info(TAG, 'onDestroy');
Logger.info(TAG, 'onSaveState');
let string = this.storage.get<string>('FaultTriggerPageString');
let counter = this.storage.get<number>('FaultTriggerPageCounter');
wantParam['FaultTriggerPageString'] = string ?? 'Empty';

View File

@ -61,7 +61,7 @@ struct FaultTriggerPage {
.fontSize('30fp')
.fontWeight(FontWeight.Bold)
.padding({ left: '24vp', right: '24vp', top: '7vp', bottom: '8vp' })
.margin({ top: '24vp' })
.margin({ top: '14vp' })
.textAlign(TextAlign.Start)
.height('56vp')
.width('100%')
@ -309,6 +309,7 @@ struct FaultTriggerPage {
.backgroundColor($r('sys.color.ohos_id_color_foreground_contrary'))
.padding({ left: '12vp', right: '12vp', top: '4vp', bottom: '4vp' })
.divider({ strokeWidth: '0.5vp', color: $r('app.color.text_grey_opacity') });
}.backgroundColor($r('sys.color.ohos_id_color_sub_background')).width('100%').height('100%');
}.backgroundColor($r('sys.color.ohos_id_color_sub_background')).width('100%').height('100%')
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]);
}
}

View File

@ -35,7 +35,7 @@ struct FirstPage {
.fontSize('30fp')
.fontWeight(FontWeight.Bold)
.padding({ left: '24vp', right: '24vp', top: '7vp', bottom: '8vp' })
.margin({ top: '24vp' })
.margin({ top: '14vp' })
.textAlign(TextAlign.Start)
.height('56vp')
.width('100%')
@ -84,9 +84,10 @@ struct FirstPage {
router.pushUrl({ url: 'pages/FaultTriggerPage' });
})
.width('88.9%')
.margin({ top: '520vp', right: '24vp', left: '24vp', bottom: '24vp' })
.margin({ top: '480vp', right: '24vp', left: '24vp', bottom: '34vp' })
.height('40vp')
.backgroundColor($r('app.color.text_blue_opacity'));
}.backgroundColor($r('sys.color.ohos_id_color_sub_background')).width('100%').height('100%');
}.backgroundColor($r('sys.color.ohos_id_color_sub_background')).width('100%').height('100%')
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]);
}
}

View File

@ -37,7 +37,7 @@ struct Index {
.fontSize('30fp')
.fontWeight(FontWeight.Bold)
.padding({ left: '24vp', right: '24vp', top: '4vp', bottom: '4vp' })
.margin({ top: '24vp' })
.margin({ top: '14vp' })
.textAlign(TextAlign.Start)
.height('56vp')
.width('100%')
@ -106,6 +106,7 @@ struct Index {
.borderRadius('24vp')
.backgroundColor($r('sys.color.ohos_id_color_foreground_contrary'))
.padding({ left: '12vp', right: '12vp', top: '4vp', bottom: '4vp' })
}.backgroundColor($r('sys.color.ohos_id_color_sub_background')).width('100%').height('100%');
}.backgroundColor($r('sys.color.ohos_id_color_sub_background')).width('100%').height('100%')
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]);
}
}

View File

@ -18,28 +18,24 @@
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"srcEntrance": "./ets/app/MyAbilityStage.ets",
"srcEntry": "./ets/app/MyAbilityStage.ets",
"mainElement": "EntryAbility",
"deviceTypes": [
"default"
],
"metadata": [ {
"name": "ArkTSPartialUpdate",
"value": "false"
} ],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntrance": "./ets/ability/EntryAbility.ets",
"srcEntry": "./ets/ability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true,
"exported": true,
"recoverable": true,
"skills": [
{
@ -54,24 +50,24 @@
},
{
"name": "SecondAbility",
"srcEntrance": "./ets/ability/SecondAbility.ets",
"srcEntry": "./ets/ability/SecondAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:TextAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true,
"exported": true,
"recoverable": true
},
{
"name": "RecoveryAbility",
"srcEntrance": "./ets/ability/RecoveryAbility.ets",
"srcEntry": "./ets/ability/RecoveryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:RecoveryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"visible": true
"exported": true
}
]
}