Feat: 新增页面

This commit is contained in:
2025-12-24 14:51:35 +08:00
parent 2ae7a88818
commit 55ae41db38
2 changed files with 29 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
@Entry @Entry
@Component @Component
struct Hello { struct Hello {
@State message: string = 'Hello World'; @State message: string = '基于鸿蒙开发';
build() { build() {
Row() { Row() {
+28 -2
View File
@@ -40,13 +40,39 @@ struct Index {
.onClick(() => { .onClick(() => {
console.log("用户操作:点击按钮") console.log("用户操作:点击按钮")
let uiContext: UIContext = this.getUIContext(); let uiContext: UIContext = this.getUIContext();
let router = uiContext.getRouter(); let router1 = uiContext.getRouter();
router.pushUrl({ router1.pushUrl({
url: 'pages/BMI' url: 'pages/BMI'
}).then(() => { }).then(() => {
console.log('系统提示:跳转成功') console.log('系统提示:跳转成功')
}) })
}) })
Column() {
Button('[关于] 关于此应用')
.width('80%')
.height(50)
.type(ButtonType.Capsule)
.fontSize(18)
.fontWeight(FontWeight.Medium)
.backgroundColor('#4C61E4')
.margin({ bottom: 80 })
}
.width('100%')
.height('80%')
.justifyContent(FlexAlign.End)
.alignItems(HorizontalAlign.Center)
.onClick(() => {
console.log("用户操作:点击按钮")
let uiContext: UIContext = this.getUIContext();
let router2 = uiContext.getRouter();
router2.pushUrl({
url: 'pages/Hello'
}).then(() => {
console.log('系统提示:跳转成功')
})
})
} }
.width('100%') .width('100%')
.height('100%') .height('100%')