From 8a0e3d5c1f644862273c5f2bcc47f4d230fda048 Mon Sep 17 00:00:00 2001 From: yiqian Date: Mon, 28 Sep 2020 14:26:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dloadmore=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E9=80=82=E9=85=8D=E5=AE=89=E5=8D=93bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/components/Loadmore.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/components/Loadmore.vue b/src/scripts/components/Loadmore.vue index 22fe4e1..67fcabc 100644 --- a/src/scripts/components/Loadmore.vue +++ b/src/scripts/components/Loadmore.vue @@ -275,8 +275,8 @@ isBottomReached() { if(this.scrollElement === window) { return ( - document.documentElement.clientHeight + (document.body.scrollTop || window.pageYOffset) - === document.body.scrollHeight + document.documentElement.clientHeight + (document.body.scrollTop || document.documentElement.scrollTop) + >= document.body.scrollHeight ); } From 7550c55dfb3f869f2527c3c51b81442a25819a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E8=93=89=E8=93=89?= Date: Wed, 2 Dec 2020 17:35:15 +0800 Subject: [PATCH 2/4] add loadmore demo --- src/scripts/components/Loadmore.vue | 7 ++- src/scripts/routes.json | 10 ++++ src/scripts/views/loadMore.vue | 75 +++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 src/scripts/views/loadMore.vue diff --git a/src/scripts/components/Loadmore.vue b/src/scripts/components/Loadmore.vue index 22fe4e1..3b6b25b 100644 --- a/src/scripts/components/Loadmore.vue +++ b/src/scripts/components/Loadmore.vue @@ -274,15 +274,20 @@ }, isBottomReached() { if(this.scrollElement === window) { + // alert('window') + // alert(`document.documentElement.clientHeight=${document.documentElement.clientHeight}---document.body.scrollTop=${document.body.scrollTop}---window.pageYOffset=${window.pageYOffset}---document.body.scrollHeight${document.body.scrollHeight}`) return ( document.documentElement.clientHeight + (document.body.scrollTop || window.pageYOffset) === document.body.scrollHeight ); } + // alert('!window') + // alert(`this.scrollElement.getBoundingClientRect().bottom=${this.scrollElement.getBoundingClientRect().bottom}---this.$el.getBoundingClientRect().bottom=${this.$el.getBoundingClientRect().bottom}`) + return ( this.scrollElement.getBoundingClientRect().bottom - >= this.$el.getBoundingClientRect().bottom + >= parseInt(this.$el.getBoundingClientRect().bottom) ); }, onTopLoaded() { diff --git a/src/scripts/routes.json b/src/scripts/routes.json index 75014d2..7c62353 100644 --- a/src/scripts/routes.json +++ b/src/scripts/routes.json @@ -214,5 +214,15 @@ "icon": "th-large" } ] + }, + { + "title": "分页加载", + "children": [ + { + "path": "/loadMore", + "name": "Load More", + "icon": "th-large" + } + ] } ] diff --git a/src/scripts/views/loadMore.vue b/src/scripts/views/loadMore.vue new file mode 100644 index 0000000..6159940 --- /dev/null +++ b/src/scripts/views/loadMore.vue @@ -0,0 +1,75 @@ + + + \ No newline at end of file From fafb90cd7be43d7563bbf36d15fafaa921441d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E8=93=89=E8=93=89?= Date: Thu, 4 Feb 2021 20:38:59 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=BD=A2=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/components/Loading.vue | 2 +- src/scripts/components/Loadmore.vue | 223 +++++++++++++++++++--------- src/scripts/views/loadMore.vue | 45 ++++-- src/styles/modules/loading.scss | 4 + src/styles/modules/loadmore.scss | 26 +++- src/styles/variables.scss | 1 + 6 files changed, 213 insertions(+), 88 deletions(-) diff --git a/src/scripts/components/Loading.vue b/src/scripts/components/Loading.vue index 770a5da..11aab86 100644 --- a/src/scripts/components/Loading.vue +++ b/src/scripts/components/Loading.vue @@ -17,7 +17,7 @@ size: { type: String, validator(value) { - return ['sm', 'lg'].indexOf(value) > -1; + return ['sm', 'md', 'lg'].indexOf(value) > -1; }, }, theme: { diff --git a/src/scripts/components/Loadmore.vue b/src/scripts/components/Loadmore.vue index bdd404f..b371ce7 100644 --- a/src/scripts/components/Loadmore.vue +++ b/src/scripts/components/Loadmore.vue @@ -1,20 +1,21 @@