Explorar el Código

feat: 首页下拉刷新回到全部活动列表

之前点击分类图标后没有"回到全部"的入口。新交互:
- 在分类筛选状态下,下拉刷新即清空 categoryId 并重新加载
- 在全部状态下,下拉刷新正常重新加载
- pages.json 中开启 enablePullDownRefresh
Developer hace 2 días
padre
commit
da93135718
Se han modificado 2 ficheros con 20 adiciones y 11 borrados
  1. 11 10
      pages.json
  2. 9 1
      pages/home.vue

+ 11 - 10
pages.json

@@ -3,7 +3,8 @@
 		{
 			"path": "pages/home",
 			"style": {
-				"navigationStyle": "custom"
+				"navigationStyle": "custom",
+				"enablePullDownRefresh": true
 			}
 		},
 		{
@@ -190,13 +191,13 @@
 		"navigationBarTitleText": "善行少年",
 		"navigationBarBackgroundColor": "#FFFFFF",
 		"navigationBarTextStyle": "black"
-	},
-	"easycom": {
-		"autoscan": true,
-		"custom": {
-			"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
-			"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
-	        "^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
-		}
+	},
+	"easycom": {
+		"autoscan": true,
+		"custom": {
+			"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
+			"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
+	        "^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
+		}
 	}
-}
+}

+ 9 - 1
pages/home.vue

@@ -267,7 +267,7 @@
 		getActivityList()
 	})
 
-	import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
+	import { onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app'
 	onShareAppMessage(() => {
 		return {
 			title: '善行少年 - 公益活动平台',
@@ -280,6 +280,14 @@
 			path: '/pages/home'
 		}
 	})
+
+	// 下拉刷新:若当前处于某个分类,回到全部列表;否则重新加载当前页
+	onPullDownRefresh(() => {
+		queryParams.value.categoryId = ''
+		initList()
+		getActivityList()
+		uni.stopPullDownRefresh()
+	})
 </script>
 
 <style scoped lang="scss">