Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yanlu
2024-04-24 13:57:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c8bc143dc2abedaf47200a9e803575dc317f5ea6
c8bc143d
1 parent
6a3a18b9
fix:bug_001-人民号的类型布局设计鸿蒙与安卓不一致
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
14 deletions
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeListComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomeListComponent.ets
View file @
c8bc143
...
...
@@ -8,9 +8,7 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
@Component
export struct PeopleShipHomeListComponent {
private controller: TabsController = new TabsController()
@State tabArr: ArticleTypeData[] = []
@State creatorId: string = ''
// 发布数量
...
...
@@ -19,17 +17,39 @@ export struct PeopleShipHomeListComponent {
@State private isLoading: boolean = false
@Consume topHeight: number
build() {
if (this.isLoading) {
this.LoadingLayout()
}
// 列表
else if(this.publishCount == 0) {
else if
(this.publishCount == 0) {
// 无数据展示
EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight)
} else {
Tabs({ barPosition: BarPosition.Start, controller: this.controller}) {
Column() {
Column() {
// 页签
Row() {
Scroll() {
Row() {
ForEach(this.tabArr, (item: ArticleTypeData, index: number) => {
this.Tab(index, item.name ?? '')
})
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.alignItems(HorizontalAlign.Start)
.width('100%')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
ForEach(this.tabArr, (item: ArticleTypeData, index: number) => {
TabContent() {
PeopleShipHomeArticleListComponent({
...
...
@@ -38,16 +58,16 @@ export struct PeopleShipHomeListComponent {
currentTopSelectedIndex: this.currentIndex,
currentIndex: index
})
}.tabBar(this.tabBuilder(index, item.name ?? ''))
}
// }.tabBar(this.tabBuilder(index, item.name ?? ''))
})
}
.backgroundColor(Color.White)
.barWidth('100%')
.barHeight('44vp'
)
.barHeight(0
)
.vertical(false)
.height(DisplayUtils.getDeviceHeight() - 100
)
.height(DisplayUtils.getDeviceHeight() - 144
)
.animationDuration(0)
.divider({
strokeWidth: '0.5vp',
...
...
@@ -59,7 +79,7 @@ export struct PeopleShipHomeListComponent {
this.currentIndex = index
})
}
}
}
@Builder
...
...
@@ -70,21 +90,33 @@ export struct PeopleShipHomeListComponent {
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
}
@Builder tabBuilder(index: number, name: string) {
// 单独的页签
@Builder
Tab(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? $r('app.color.color_222222') : $r('app.color.color_666666')
)
.fontColor(this.currentIndex === index ? $r('app.color.color_222222') : $r('app.color.color_666666'))
.fontSize(18)
.fontWeight(this.currentIndex === index ? 500 : 400)
.lineHeight(22)
.height(22)
.margin({ top: 11, bottom: 1 })
Divider()
.width('15vp')
.strokeWidth(2)
.color('#CB0000')
.opacity(this.currentIndex === index ? 1 : 0)
}.width('100%')
}
.justifyContent(FlexAlign.Center)
.constraintSize({ minWidth: 35 })
.margin({
left: '16vp',
right: '16vp'
})
.height('44vp')
.onClick(() => {
this.controller.changeIndex(index)
this.currentIndex = index
})
}
async aboutToAppear() {
...
...
Please
register
or
login
to post a comment