选择小区加下拉刷新
This commit is contained in:
@@ -19,13 +19,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 小区列表 -->
|
||||
<scroll-view
|
||||
class="community-list"
|
||||
scroll-y
|
||||
:scroll-into-view="scrollIntoViewId"
|
||||
@scrolltolower="loadMoreData"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="community-list">
|
||||
<view
|
||||
v-for="item in displayedCommunities"
|
||||
:key="item.villageId"
|
||||
@@ -74,7 +68,7 @@
|
||||
<text class="empty-text">未找到相关小区</text>
|
||||
<text class="empty-tip">请尝试其他关键词</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 确认按钮 -->
|
||||
<view class="confirm-area">
|
||||
@@ -92,7 +86,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
||||
import { getVillageList, getVillageSwitch } from "../api/api.js"
|
||||
|
||||
// 响应式数据
|
||||
@@ -187,6 +181,7 @@ const getCommunityList = async (pageNum = 1, keyword = '') => {
|
||||
})
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
uni.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +199,17 @@ const loadMoreData = () => {
|
||||
currentPage.value += 1
|
||||
}
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh(() => {
|
||||
currentPage.value = 1
|
||||
getCommunityList(1, searchText.value)
|
||||
})
|
||||
|
||||
// 上拉加载更多
|
||||
onReachBottom(() => {
|
||||
loadMoreData()
|
||||
})
|
||||
|
||||
// 处理搜索输入(防抖)
|
||||
const handleSearchInput = (e) => {
|
||||
let val = e.detail.value || ''
|
||||
@@ -363,7 +369,6 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.community-list {
|
||||
flex: 1;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 180rpx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user