新增题库页面和学习统计页面的框架,并写成组件

This commit is contained in:
2026-05-07 18:01:01 +08:00
parent ba7e154d87
commit f869743ff4
5 changed files with 78 additions and 31 deletions

View File

@@ -0,0 +1,15 @@
@Component
export struct HomeContent {
build() {
Column() {
Text('首页')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}

View File

@@ -0,0 +1,15 @@
@Component
export struct MineContent {
build() {
Column() {
Text('我的')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}

View File

@@ -0,0 +1,15 @@
@Component
export struct QuestionBankContent {
build() {
Column() {
Text('题库')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}

View File

@@ -0,0 +1,15 @@
@Component
export struct StatsContent {
build() {
Column() {
Text('学习统计')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}

View File

@@ -1,3 +1,8 @@
import { HomeContent } from '../components/HomeContent';
import { QuestionBankContent } from '../components/QuestionBankContent';
import { StatsContent } from '../components/StatsContent';
import { MineContent } from '../components/MineContent';
@Entry
@Component
struct HomePage {
@@ -6,14 +11,24 @@ struct HomePage {
build() {
Tabs({ barPosition: BarPosition.End, index: this.currentIndex }) {
TabContent() {
this.HomeContent()
HomeContent()
}
.tabBar(this.TabBarItem(0, '首页', '○'))
TabContent() {
this.MineContent()
QuestionBankContent()
}
.tabBar(this.TabBarItem(1, '我的', '○'))
.tabBar(this.TabBarItem(1, '题库', '○'))
TabContent() {
StatsContent()
}
.tabBar(this.TabBarItem(2, '统计', '○'))
TabContent() {
MineContent()
}
.tabBar(this.TabBarItem(3, '我的', '○'))
}
.barMode(BarMode.Fixed)
.onChange((index: number) => {
@@ -40,32 +55,4 @@ struct HomePage {
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
@Builder
HomeContent() {
Column() {
Text('首页')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
@Builder
MineContent() {
Column() {
Text('我的')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#333333')
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
}
}