From 2a8f6c3f82e11800561905fb80c72907f966d0b4 Mon Sep 17 00:00:00 2001 From: hdx Date: Tue, 17 Oct 2023 18:06:03 +0800 Subject: [PATCH] =?UTF-8?q?chore(long-list):=20=E7=A7=BB=E9=99=A4=E6=97=A7?= =?UTF-8?q?=E7=89=88=E6=9C=AC=20loading=20=E7=9A=84=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/template/long-list/long-list-page.uvue | 43 ++++---------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/pages/template/long-list/long-list-page.uvue b/pages/template/long-list/long-list-page.uvue index bf7f90ae..cfa34b28 100644 --- a/pages/template/long-list/long-list-page.uvue +++ b/pages/template/long-list/long-list-page.uvue @@ -2,10 +2,10 @@ - + - + {{item.plugin_name}} @@ -22,8 +22,9 @@ {{item.author_name}} - - + + + {{loadingText}} @@ -81,35 +82,17 @@ } else { return "" } - }, + } }, created() { - this.insertLoadingData() - if (this.preload) { this.loadData(null) } }, methods: { - // TODO 目前 list-item 不支持注释节点 - // 暂时在数据末尾插入一条空数据用于显示 loading - insertLoadingData() { - const loadingData = { - plugin_id: -1, - plugin_img_link: '', - plugin_name: '', - plugin_intro: '', - score: 0, - tags: [], - update_date: '', - author_name: '', - } as ListItem - this.dataList.push(loadingData) - }, refreshData(loadComplete : (() => void) | null) { this.dataList.length = 0 this.$currentPage = 1 - this.insertLoadingData() this.loadData(loadComplete) }, loadData(loadComplete : (() => void) | null) { @@ -131,9 +114,7 @@ return } - // TODO - this.dataList.splice(this.dataList.length - 1, 0, ...responseData.data) - // this.dataList.push(...responseData.data) + this.dataList.push(...responseData.data) if (responseData.data.length == 0) { this.isEnded = true @@ -254,20 +235,12 @@ } .loading { - /* position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; */ - flex:1; - margin: -10px; + padding: 20px; background-color: #f8f8f8; - margin-bottom: 1px; justify-content: center; } .loading-text { - padding: 20px; text-align: center; } -- GitLab