新增题库页面和学习统计页面的框架,并写成组件
This commit is contained in:
15
entry/src/main/ets/components/HomeContent.ets
Normal file
15
entry/src/main/ets/components/HomeContent.ets
Normal 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)
|
||||
}
|
||||
}
|
||||
15
entry/src/main/ets/components/MineContent.ets
Normal file
15
entry/src/main/ets/components/MineContent.ets
Normal 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)
|
||||
}
|
||||
}
|
||||
15
entry/src/main/ets/components/QuestionBankContent.ets
Normal file
15
entry/src/main/ets/components/QuestionBankContent.ets
Normal 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)
|
||||
}
|
||||
}
|
||||
15
entry/src/main/ets/components/StatsContent.ets
Normal file
15
entry/src/main/ets/components/StatsContent.ets
Normal 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)
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user