From 6022868fc79fe659798f37227cec280f560d45ea Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Thu, 29 Sep 2022 13:48:38 +0800 Subject: [PATCH] =?UTF-8?q?list=E5=8A=A0=E8=BD=BD=E5=8A=A0=E4=B8=8Aloading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mixins/booklist.js | 9 +++++++-- src/views/module/bookList.vue | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/views/mixins/booklist.js b/src/views/mixins/booklist.js index 6163527..c2985e0 100644 --- a/src/views/mixins/booklist.js +++ b/src/views/mixins/booklist.js @@ -6,8 +6,9 @@ export const bookListCrud = { defaultImg: 'this.src="' + require('@/assets/images/default-img.png') + '"', bookData: [], page: 1, - pageSize: 9, - pageCount: 1 + pageSize: 13, + pageCount: 1, + bookLoading: false } }, computed: { @@ -20,6 +21,7 @@ export const bookListCrud = { methods: { // 获取热门/新书图书list getBookData() { + this.bookLoading = true const bookType = this.$route.query.bookType const params = { libcode: this.libcode, @@ -53,6 +55,7 @@ export const bookListCrud = { FetchCoverByISBN(params).then((res) => { item.cover = window.URL.createObjectURL(res) this.bookData.push(item) + this.bookLoading = false }) }, // 滚动加载 @@ -62,8 +65,10 @@ export const bookListCrud = { const scrollHeight = e.target.scrollHeight // 滚动条到底部 if (scrollTop + windowHeight === scrollHeight) { + this.bookLoading = true this.page++ if (this.page > this.pageCount) { + this.bookLoading = false this.$message.success('暂无更多数据~') return } diff --git a/src/views/module/bookList.vue b/src/views/module/bookList.vue index 343269c..9268527 100644 --- a/src/views/module/bookList.vue +++ b/src/views/module/bookList.vue @@ -1,5 +1,5 @@