diff --git a/pages/template/long-list/long-list-page.uvue b/pages/template/long-list/long-list-page.uvue index 06fcabe6372295d56d0771a998cbc189255611e8..167b564ed3b5181db1a0547896ff11912cb1eb03 100644 --- a/pages/template/long-list/long-list-page.uvue +++ b/pages/template/long-list/long-list-page.uvue @@ -1,27 +1,33 @@ @@ -57,9 +63,23 @@ loading: false, dataList: [] as ListItem[], isEnded: false, + loadingError: '', $currentPage: 0 } }, + computed: { + loadingText() : string { + if (this.loading) { + return "加载中..." + } else if (this.isEnded) { + return "没有更多了" + } else if (this.loadingError.length > 0) { + return this.loadingError + } else { + return "" + } + } + }, mounted() { uni.loadFontFace({ global: false, @@ -105,7 +125,7 @@ } }, fail: (err) => { - console.log(err) + this.loadingError = err.errMsg }, complete: () => { this.loading = false @@ -128,10 +148,6 @@ if (nullStarCount > 0) { result += null_code.repeat(nullStarCount) } return result - }, - onScroll(e : ScrollEvent) { - // TODO e.detail.deltaY 值不正确 - this.$emit('pageScroll', e.detail.deltaY) } } } @@ -215,4 +231,10 @@ color: #008000; margin-left: auto; } + + .loading { + padding: 20px; + text-align: center; + background-color: #f8f8f8; + } \ No newline at end of file diff --git a/pages/template/long-list/long-list.uvue b/pages/template/long-list/long-list.uvue index 50351e1a65760f6a5e16fbaab93adce20ddb7858..1d45b45f331643d734c17f5849be463d8fd0f8d8 100644 --- a/pages/template/long-list/long-list.uvue +++ b/pages/template/long-list/long-list.uvue @@ -10,7 +10,7 @@ {{item.name}} + :class="swiperIndex==index ? 'swiper-tabs-item-text-active' : ''">{{item.name}} @@ -22,7 +22,7 @@ - + @@ -120,17 +120,9 @@ //console.log(this.$lastSwiperIndex, moveToIndex, offsetX, this.$swiperWidth, percentage); }, onSwiperAnimationfinish(e : SwiperAnimationFinishEvent) { - this.$lastSwiperIndex = e.detail.current; // console.log("onSwiperAnimationfinish", e.detail.current); - // this.setSwiperIndex(e.detail.current, true); - }, - onSwiperItemPageScroll(dy : number) { - let top = this.pageScrollTop + dy - - if (top > this.$headerHeight) { top = this.$headerHeight } - if (top < 0) { top = 0 } - - this.pageScrollTop = top + this.$lastSwiperIndex = e.detail.current + this.setSwiperIndex(e.detail.current, true) }, queryTabItemsSize() { this.$swiperTabsRect.length = 0; @@ -186,7 +178,8 @@ } .swiper-list { - height: 100%; + flex: 1; + /* height: 100%; */ } .swiper-tabs {