From d77dae6292d73a9caf920e5afa615e068523defd Mon Sep 17 00:00:00 2001 From: zyn Date: Fri, 1 Dec 2023 16:26:54 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzwlComponents/phone/PhoneScroll.vue | 36 +++++++++++-------- src/pages/phone/domesticStand/index.vue | 8 ++--- .../standDynamics/components/DataCenter.vue | 4 +-- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/components/hzwlComponents/phone/PhoneScroll.vue b/src/components/hzwlComponents/phone/PhoneScroll.vue index 8cbd30c10..632ccc387 100644 --- a/src/components/hzwlComponents/phone/PhoneScroll.vue +++ b/src/components/hzwlComponents/phone/PhoneScroll.vue @@ -17,17 +17,6 @@ - - 加载中... - @@ -40,12 +29,23 @@ color="#3170A8" style="text-align: center" >加载中... - + + + 加载中... @@ -129,6 +129,10 @@ export default { }, watch: { data() { + if (this.data.length === 0) { + this.scrollTo(0,0) + this.isEmpty = true + } this.refreshScroll() } }, @@ -191,6 +195,7 @@ export default { // 下拉刷新回调 async pullingDownHandler () { this.showPullDownText('pullDownLoading') + this.hidePullUpText() // 从第一页获取数据 await this.getDataHandler(1) @@ -201,8 +206,7 @@ export default { }, showPullUpText () { - this.isEmpty = false - this.isShowAll = false + this.hidePullUpText() if (this.data.length === 0) { this.isEmpty = true } else { @@ -211,6 +215,10 @@ export default { } } }, + hidePullUpText () { + this.isEmpty = false + this.isShowAll = false + }, showPullDownText (key) { this.isEnterThreshold = false this.isLeaveThreshold = false diff --git a/src/pages/phone/domesticStand/index.vue b/src/pages/phone/domesticStand/index.vue index de1706dbe..aab90e329 100644 --- a/src/pages/phone/domesticStand/index.vue +++ b/src/pages/phone/domesticStand/index.vue @@ -183,10 +183,10 @@ export default { methods: { onSearch () { this.list = [] - this.searchQuery.page = 1 - // 返回顶部 - this.$refs.scroll.scrollTo(0, 0) - this.getData() + // this.searchQuery.page = 1 + // // 返回顶部 + // this.$refs.scroll.scrollTo(0, 0) + this.getData(1) }, getData (page) { switch (this.$route.query.standType) { diff --git a/src/pages/phone/standDynamics/components/DataCenter.vue b/src/pages/phone/standDynamics/components/DataCenter.vue index 090e5c156..0a18981ce 100644 --- a/src/pages/phone/standDynamics/components/DataCenter.vue +++ b/src/pages/phone/standDynamics/components/DataCenter.vue @@ -67,8 +67,8 @@ export default { setChecked (currentData) { this.currentSearch = currentData this.searchQuery.treeId = currentData.id || '' - this.searchQuery.page = 1 - this.getData() + this.list = [] + this.getData(1) }, getData (page) { return new Promise((resolve, reject) => {