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
wangyong_wd
2024-04-03 13:12:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
873e402ef48a16bad302ff61b2d2b3df0ba430ed
873e402e
1 parent
73de24ee
频道中”播报“添加跳转到播报页面的逻辑
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 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 @
873e402
...
...
@@ -11,6 +11,7 @@ const TAG = 'TopNavigationComponent';
*/
@Component
export struct TopNavigationComponent {
private controller: TabsController = new TabsController()
@Prop _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
...
...
@@ -76,8 +77,12 @@ export struct TopNavigationComponent {
})
}
isBroadcast (item: TopNavDTO) {
return item.name === '播报'
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
RelativeContainer() {
Stack({ alignContent: Alignment.Center }) {
...
...
@@ -163,10 +168,10 @@ export struct TopNavigationComponent {
.width('100%')
.height(40)
.visibility(this._currentNavIndex == 0 ? Visibility.Visible : Visibility.None)
// 频道分类list
Stack({ alignContent: Alignment.TopEnd }) {
Tabs() {
Tabs(
{controller: this.controller}
) {
ForEach(this.myChannelList, (navItem: TopNavDTO, index: number) => {
TabContent() {
PageComponent({
...
...
@@ -184,9 +189,22 @@ export struct TopNavigationComponent {
.vertical(false)
.onChange((index: number) => {
Logger.info(TAG, `onChange index : ${index}`);
if(!this.isBroadcast(this.myChannelList[index])) {
this.currentTopNavSelectedIndex = index;
} else {
// 跳转到播报页面
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'BroadcastPage',
id: this.myChannelList[index].pageId
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
this.controller.changeIndex(this.currentTopNavSelectedIndex)
}
})
// 分类列表最右侧频道设置
ChannelSubscriptionLayout({
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
...
...
Please
register
or
login
to post a comment