Showing
1 changed file
with
5 additions
and
1 deletions
| @@ -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,14 +220,18 @@ export struct PageComponent { | @@ -220,14 +220,18 @@ 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) { |
| 230 | + if(this.needload){ | ||
| 229 | this.getData(); | 231 | this.getData(); |
| 230 | } | 232 | } |
| 233 | + this.needload = false; | ||
| 234 | + } | ||
| 231 | } | 235 | } |
| 232 | 236 | ||
| 233 | onAutoRefresh() { | 237 | onAutoRefresh() { |
-
Please register or login to post a comment