zhangbo1_wd

布局优化

... ... @@ -72,6 +72,7 @@ export struct TopNavigationComponentNew {
private tabsWidth: number = 0
build() {
Column() {
// 频道分类list
RelativeContainer() {
this.tabBar()
... ... @@ -135,6 +136,7 @@ export struct TopNavigationComponentNew {
.width('100%')
.height('100%')
}
}
@Builder
topBar() {
... ... @@ -316,7 +318,7 @@ export struct TopNavigationComponentNew {
bottom: 2,
})
.id(`col_tabBar${index}`)
.margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
// .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
.onClick(() => {
Logger.debug(TAG, `onClick, index: ${index}`);
if (this.currentTopNavSelectedIndex === index) {
... ... @@ -487,9 +489,19 @@ export struct TopNavigationComponentNew {
}
/**
* 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。
*/
private isCurrentPage(): boolean {
return this._currentNavIndex === this.bottomNavIndex
}
/**
* 频道id变化,即指定频道跳转场景
*/
onAssignChannelChange() {
if (!this.isCurrentPage()) {
return
}
let channelId = this.assignChannel.channelId
let index = -1
if (this._currentNavIndex === 0) {
... ... @@ -537,7 +549,7 @@ export struct TopNavigationComponentNew {
private getChannelByMine(channelId: string) {
for (let i = 0; i < this.myChannelList.length; i++) {
let topNavDTO: TopNavDTO = this.myChannelList[i]
if (topNavDTO.channelId?.toString() === channelId) {
if (topNavDTO?.channelId?.toString() === channelId) {
return i
}
}
... ...