From e377702b4a593e8eb06d59aac424bd64eaf91bb0 Mon Sep 17 00:00:00 2001 From: "jqtmviyu@gmail.com" Date: Thu, 25 Feb 2021 22:41:50 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=B8=8B=E6=8B=89=E5=88=B7=E6=96=B0=202.?= =?UTF-8?q?=20=E7=BF=BB=E9=A1=B5=E5=88=B0=E5=BA=95=E9=83=A8=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages.json | 3 ++- src/pages/goods_list/goods_list.vue | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/pages.json b/src/pages.json index a6c0cbe..8142228 100644 --- a/src/pages.json +++ b/src/pages.json @@ -18,7 +18,8 @@ { "path": "pages/goods_list/goods_list", "style": { - "navigationBarTitleText": "商品列表" + "navigationBarTitleText": "商品列表", + "enablePullDownRefresh":true } }, { diff --git a/src/pages/goods_list/goods_list.vue b/src/pages/goods_list/goods_list.vue index fb56ab5..6c70d01 100644 --- a/src/pages/goods_list/goods_list.vue +++ b/src/pages/goods_list/goods_list.vue @@ -38,6 +38,8 @@ 价格 + + 没有更多数据 @@ -72,7 +74,9 @@ export default { ], tabsCurrent: 0, // 商品列表 - goods: [] + goods: [], + // 在页面底部显示是否有更多数据 + hasMore: true, } }, @@ -86,6 +90,7 @@ export default { // 判断有没有下一页 if(Params.pagenum >= TotalPage){ console.log("没有下一页数据了") + this.hasMore = false uni.showToast({ title: "没有更多数据了", icon:"none", @@ -97,6 +102,15 @@ export default { this.getGoods() } }, + // 下拉刷新 + async onPullDownRefresh(){ + this.goods = [] + this.hasMore = false + Params.pagenum = 1 + await this.getGoods() + // 关闭刷新效果 + uni.stopPullDownRefresh() + }, methods: { // 从接口拿数据