Feat: 添加跳转计算 BMI 按钮

This commit is contained in:
2025-12-23 17:06:02 +08:00
parent a6a0d26737
commit a66c7d2d85
2 changed files with 28 additions and 8 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ struct Hello {
let uiContext: UIContext = this.getUIContext(); let uiContext: UIContext = this.getUIContext();
let router = uiContext.getRouter(); let router = uiContext.getRouter();
router.pushUrl({ router.pushUrl({
url: 'pages/Second' url: 'pages/Text'
}).then(() => { }).then(() => {
console.log('系统提示:跳转成功') console.log('系统提示:跳转成功')
}) })
+27 -7
View File
@@ -7,18 +7,38 @@ struct Index {
private scroller: Scroller = new Scroller(); private scroller: Scroller = new Scroller();
build() { build() {
Scroll(this.scroller) { Stack() {
Scroll(this.scroller) {
Column() {
Module0()
Module1()
}
.width('100%')
}
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.align(Alignment.Top)
.backgroundColor($r('app.color.page_bg_color'))
// 底部按钮
Column() { Column() {
Module0() Button('[前往] 计算我的 BMI')
Module1() .width('80%')
.height(50)
.type(ButtonType.Capsule)
.fontSize(18)
.fontWeight(FontWeight.Medium)
.backgroundColor('#4C61E4')
.margin({ bottom: 20 })
} }
.width('100%') .width('100%')
.height('100%')
.justifyContent(FlexAlign.End)
.alignItems(HorizontalAlign.Center)
} }
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
.width('100%') .width('100%')
.height('100%') .height('100%')
.align(Alignment.Top)
.backgroundColor($r('app.color.page_bg_color'))
} }
} }