From c08e628b38680ff72b8062cc3d38ed80de7c2b03 Mon Sep 17 00:00:00 2001 From: wonder Date: Fri, 19 Dec 2025 17:15:41 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=20=E5=A2=9E=E5=8A=A0=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E4=BF=AE=E6=94=B9=E8=B7=AF=E7=94=B1=EF=BC=8C?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=A1=B5=E9=9D=A2=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/Index.ets | 22 ++++++++++++++ entry/src/main/ets/pages/Second.ets | 29 +++++++++++++++++++ .../resources/base/profile/main_pages.json | 3 +- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 entry/src/main/ets/pages/Second.ets diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index aa2bbab..a745e49 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -12,6 +12,28 @@ struct Index { .onClick(() => { this.message = 'Welcome'; }) + Button() { + Text('Next') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + .onClick(() => { + console.log("用户操作:点击按钮") + let uiContext: UIContext = this.getUIContext(); + let router = uiContext.getRouter(); + router.pushUrl({ + url: 'pages/Second' + }).then(() => { + console.log('系统提示:跳转成功') + }) + }) } .width('100%') } diff --git a/entry/src/main/ets/pages/Second.ets b/entry/src/main/ets/pages/Second.ets new file mode 100644 index 0000000..bfda83b --- /dev/null +++ b/entry/src/main/ets/pages/Second.ets @@ -0,0 +1,29 @@ +@Entry +@Component +struct Second { + @State message: string = '万物互联'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('Back') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json index 1898d94..f6191bd 100644 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,6 @@ { "src": [ - "pages/Index" + "pages/Index", + "pages/Second" ] }