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
zhangbo1_wd
2024-05-21 19:00:58 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
91cf9910f1fac0efece1d9eb35790b8743a5af30
91cf9910
1 parent
7c6b9bc2
顶导添加判空保护
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponent.ets
View file @
91cf991
...
...
@@ -35,6 +35,9 @@ export struct TopNavigationComponent {
@Link _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
/**
* @deprecated TODO,没地方用到,是否弃用
*/
@State currentTopNavName: string = '';
@State currentTopNavItem: TopNavDTO = {} as TopNavDTO
// 顶导数据
...
...
@@ -154,7 +157,7 @@ export struct TopNavigationComponent {
// 崩溃
// this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name
if (this._currentNavIndex === 0 && this.myChannelList && this.myChannelList.length > 0 &&
if (this._currentNavIndex === 0 && this.myChannelList && this.myChannelList.length > 0 &&
this.myChannelList[0] &&
this.myChannelList[0].name) {
this.currentTopNavName = this.myChannelList[0].name
} else if (this._currentNavIndex != 0 && this.topNavList && this.topNavList.length > 0 && this.topNavList[0].name) {
...
...
@@ -170,19 +173,19 @@ export struct TopNavigationComponent {
this.currentTopNavItem = this.myChannelList[this.currentTopNavSelectedIndex]
}
isBroadcast(item: TopNavDTO) {
isBroadcast(item
?
: TopNavDTO) {
// TODO 用id channelId = '2066'
return item.name === '播报'
return item
?
.name === '播报'
}
isLayout(item: TopNavDTO) {
isLayout(item
?
: TopNavDTO) {
// TODO 用id channelId = '2006'
return item.name === '版面'
return item
?
.name === '版面'
}
isSpecialChannel(item: TopNavDTO) {
isSpecialChannel(item
?
: TopNavDTO) {
// 版面、播报,可以用这个判断
return item.channelType === 3
return item
?
.channelType === 3
}
...
...
@@ -374,7 +377,7 @@ export struct TopNavigationComponent {
@Builder
tabBarBuilder(item: TopNavDTO, index: number) {
Column() {
Text(item.name)
Text(item
?
.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.currentTopNavSelectedIndex === index ? Color.Black : "#999999")
...
...
Please
register
or
login
to post a comment