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