yuzhilin

默认选中热点频道

@@ -11,7 +11,7 @@ import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; @@ -11,7 +11,7 @@ import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
11 const TAG = 'TopNavigationComponent'; 11 const TAG = 'TopNavigationComponent';
12 12
13 PersistentStorage.persistProp('channelIds', ''); 13 PersistentStorage.persistProp('channelIds', '');
14 -PersistentStorage.persistProp('indexSettingChannelId', 0); 14 +PersistentStorage.persistProp('indexSettingChannelId', 2002);
15 15
16 const storage = LocalStorage.getShared(); 16 const storage = LocalStorage.getShared();
17 17
@@ -36,7 +36,7 @@ export struct TopNavigationComponent { @@ -36,7 +36,7 @@ export struct TopNavigationComponent {
36 // 顶导数据 36 // 顶导数据
37 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] 37 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
38 @State compList: LazyDataSource<CompDTO> = new LazyDataSource(); 38 @State compList: LazyDataSource<CompDTO> = new LazyDataSource();
39 - @StorageProp('indexSettingChannelId') indexSettingChannelId: number = 0 39 + @StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002
40 //我的频道id列表 40 //我的频道id列表
41 @State channelIds: number[] = [] 41 @State channelIds: number[] = []
42 //本地缓存频道id列表 42 //本地缓存频道id列表
@@ -121,13 +121,9 @@ export struct TopNavigationComponent { @@ -121,13 +121,9 @@ export struct TopNavigationComponent {
121 this.myChannelList = _myChannelList 121 this.myChannelList = _myChannelList
122 122
123 //缓存首页频道 123 //缓存首页频道
124 - if (!this.indexSettingChannelId) {  
125 - AppStorage.set('indexSettingChannelId', this.homeChannelList[0].channelId)  
126 - } else {  
127 - let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)  
128 - if (index > -1) {  
129 - this.currentTopNavSelectedIndex = index  
130 - } 124 + let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
  125 + if (index > -1) {
  126 + this.currentTopNavSelectedIndex = index
131 } 127 }
132 } 128 }
133 129