diff --git a/README.en.md b/README.en.md index c2f46cee5580b7832771ddcbff6ec00e87079479..3204a70c82fef2397b7f279d172618d3496100b1 100644 --- a/README.en.md +++ b/README.en.md @@ -46,8 +46,8 @@ Ensure that these permissions are added in the **module.json5** file. 1. The sample is only supported on Huawei phones with standard systems. -2. The HarmonyOS version must be HarmonyOS 5.0.0 Release or later. +2. The HarmonyOS version must be HarmonyOS 5.0.4 Release or later. -3. The DevEco Studio version must be DevEco Studio 5.0.0 Release or later. +3. The DevEco Studio version must be DevEco Studio 5.0.4 Release or later. -4. The HarmonyOS SDK version must be HarmonyOS 5.0.0 Release SDK or later. \ No newline at end of file +4. The HarmonyOS SDK version must be HarmonyOS 5.0.4 Release SDK or later. \ No newline at end of file diff --git a/README.md b/README.md index 753a72823029c7b27b2ee28a19b0fca79a9643bf..689da574ff95f980efeb75d369790e8ba99d020a 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ 1.本示例仅支持标准系统上运行,支持设备:华为手机。 -2.HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +2.HarmonyOS系统:HarmonyOS 5.0.4 Release及以上。 -3.DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +3.DevEco Studio版本:DevEco Studio 5.0.4 Release及以上。 -4.HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 \ No newline at end of file +4.HarmonyOS SDK版本:HarmonyOS 5.0.4 Release SDK及以上。 \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index fcf3585351b8d6a0f28c78cf8496a3316400e527..69a62dcb963f4908e94de3ab66c662cf660cae0d 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -25,6 +25,7 @@ import Logger from '../common/Logger'; @Entry @Component struct Index { + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack(); private dataPreferences: preferences.Preferences | null = null; private kvManager: distributedKVStore.KVManager | undefined = undefined; private context = this.getUIContext().getHostContext()! @@ -41,8 +42,15 @@ struct Index { }.alignItems(HorizontalAlign.Start) } + @Builder + PageMap(name: string) { + if (name === 'fileList') { + File() + } + } + build() { - Navigation() { + Navigation(this.pageInfos) { Column() { Button($r('app.string.tab2')) .width(328) @@ -149,23 +157,20 @@ struct Index { }) .margin({ bottom: '12' }) - Navigation() { - Button($r('app.string.tab3')) - .width(328) - .height(40) - .margin({ bottom: '16' }) + Button($r('app.string.tab3')) + .width(328) + .height(40) + .margin({ bottom: '16' }) + .onClick(() => { + this.pageInfos.pushPathByName('fileList', null); + }) - NavDestination() { - Flex({ direction: FlexDirection.Row }) { - File(); - } - }.title(this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.tab3'))) - } } .justifyContent(FlexAlign.End) .width('100%') .height('100%') } + .navDestination(this.PageMap) .title(this.NavigationTitle) .titleMode(NavigationTitleMode.Full) } diff --git a/entry/src/main/ets/view/File.ets b/entry/src/main/ets/view/File.ets index a85d0ef26e313ee69a1fe35dae40b2a26aee8d70..10455e649ae8e044105e2d911997a1c8e53e7e74 100644 --- a/entry/src/main/ets/view/File.ets +++ b/entry/src/main/ets/view/File.ets @@ -92,50 +92,55 @@ export struct File { } build() { - Column({ space: 12 }) { - Text($r('app.string.txt1')) - .width('100%') - .padding({ left: '16', top: '8' }) - .fontWeight(FontWeight.Medium) - .fontSize(18) + NavDestination() { + Flex({ direction: FlexDirection.Row }) { + Column({ space: 12 }) { + Text($r('app.string.txt1')) + .width('100%') + .padding({ left: '16', top: '8' }) + .fontWeight(FontWeight.Medium) + .fontSize(18) - TextArea({ text: this.fileList }) - .textAlign(TextAlign.Start) - .margin({ left: '16', right: '16' }) + TextArea({ text: this.fileList }) + .textAlign(TextAlign.Start) + .margin({ left: '16', right: '16' }) - Text($r('app.string.txt2')) - .textAlign(TextAlign.Start) - .width('100%') - .padding({ left: '16' }) - .fontWeight(FontWeight.Medium) - .fontSize(18) + Text($r('app.string.txt2')) + .textAlign(TextAlign.Start) + .width('100%') + .padding({ left: '16' }) + .fontWeight(FontWeight.Medium) + .fontSize(18) - TextArea({ text: this.preferenceList }) - .textAlign(TextAlign.Start) - .margin({ left: '16', right: '16' }) + TextArea({ text: this.preferenceList }) + .textAlign(TextAlign.Start) + .margin({ left: '16', right: '16' }) - Text($r('app.string.txt3')) - .textAlign(TextAlign.Start) - .width('100%') - .padding({ left: '16' }) - .fontWeight(FontWeight.Medium) - .fontSize(18) + Text($r('app.string.txt3')) + .textAlign(TextAlign.Start) + .width('100%') + .padding({ left: '16' }) + .fontWeight(FontWeight.Medium) + .fontSize(18) - TextArea({ text: this.rdbList }) - .textAlign(TextAlign.Start) - .margin({ left: '16', right: '16' }) + TextArea({ text: this.rdbList }) + .textAlign(TextAlign.Start) + .margin({ left: '16', right: '16' }) - Text($r('app.string.txt4')) - .textAlign(TextAlign.Start) - .width('100%') - .padding({ left: '16' }) - .fontWeight(FontWeight.Medium) - .fontSize(18) + Text($r('app.string.txt4')) + .textAlign(TextAlign.Start) + .width('100%') + .padding({ left: '16' }) + .fontWeight(FontWeight.Medium) + .fontSize(18) - TextArea({ text: this.kvStoreList }) - .textAlign(TextAlign.Start) - .margin({ left: '16', right: '16' }) - .enableAutoFill(true) + TextArea({ text: this.kvStoreList }) + .textAlign(TextAlign.Start) + .margin({ left: '16', right: '16' }) + .enableAutoFill(true) + } + } } + .title(this.getUIContext().getHostContext()!.resourceManager.getStringSync($r('app.string.tab3'))) } } \ No newline at end of file