定损回滚优化

This commit is contained in:
hayu 2026-01-21 18:06:07 +08:00
parent 4970361442
commit d94835f6c5
1 changed files with 19 additions and 1 deletions

View File

@ -43,7 +43,7 @@
</uni-col>
</uni-row>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<scroll-view scroll-y :scroll-top="scrollTop" @scroll="onScroll" @scrolltolower="onScrollTolower" class="scroll-container">
<view class="table-list-item" :key="index" @click="handleItem(item)" v-for="(item, index) in tableList">
<uni-swipe-action>
<uni-swipe-action-item @click="onClick($event, item)" :right-options="active==1 ? options : []">
@ -152,6 +152,7 @@ const queryParams = ref({
pageNum: 1,
pageSize: 10,
})
const scrollTop = ref(0) //
//
const options = ref([
@ -233,6 +234,10 @@ const getTableList = async (isTap = false) => {
})
console.log('queryParams.value查询参数', queryParams.value)
const res = await getLossAssessmentListAPI(queryParams.value)
setTimeout(() => {
scrollTop.value = uni.getStorageSync('scrollTop') || 0
console.log('🚀 ~ scrollTop.value:', scrollTop.value)
}, 400)
total.value = res.data.total
if (isTap) {
tableList.value = res.data.rows
@ -272,6 +277,15 @@ onShow(() => {
getTableList(true)
})
let timers = null
const onScroll = (e) => {
if (timers) clearTimeout(timers)
timers = setTimeout(() => {
uni.setStorageSync('scrollTop', e.detail.scrollTop)
uni.setStorageSync('queryParams', JSON.stringify(queryParams.value))
}, 500)
}
//
const onScrollTolower = debounce(() => {
console.log('触底事件')
@ -284,6 +298,10 @@ const onScrollTolower = debounce(() => {
// tap
const changeTab = (index) => {
active.value = index
uni.setStorageSync('scrollTop', 0)
uni.setStorageSync('activeTab', index)
uni.removeStorageSync('queryParams')
uni.removeStorageSync('scrollTop')
queryParams.value.pageNum = 1
tableList.value = []
if (index == 1) {