张善主

fix(频道切换):增加切换刷新接口控制

@@ -28,7 +28,7 @@ export struct PageComponent { @@ -28,7 +28,7 @@ export struct PageComponent {
28 // 自动刷新通知 28 // 自动刷新通知
29 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 29 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0
30 private listScroller: Scroller = new Scroller(); 30 private listScroller: Scroller = new Scroller();
31 - 31 + needload: boolean = true;
32 build() { 32 build() {
33 Column() { 33 Column() {
34 if (this.pageModel.viewType == ViewType.LOADING) { 34 if (this.pageModel.viewType == ViewType.LOADING) {
@@ -220,13 +220,17 @@ export struct PageComponent { @@ -220,13 +220,17 @@ export struct PageComponent {
220 // 选中tab,才请求数据。拦截大量接口请求 220 // 选中tab,才请求数据。拦截大量接口请求
221 if (this.navIndex === this.currentTopNavSelectedIndex) { 221 if (this.navIndex === this.currentTopNavSelectedIndex) {
222 this.getData(); 222 this.getData();
  223 + this.needload = false;
223 } 224 }
224 } 225 }
225 226
226 onChange() { 227 onChange() {
227 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); 228 Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
228 if (this.navIndex === this.currentTopNavSelectedIndex) { 229 if (this.navIndex === this.currentTopNavSelectedIndex) {
229 - this.getData(); 230 + if(this.needload){
  231 + this.getData();
  232 + }
  233 + this.needload = false;
230 } 234 }
231 } 235 }
232 236