Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[t-pull-down-refresh] 在列表的任何位置滑动,都会触发下拉刷新 #1433

Open
1943715762 opened this issue Jun 6, 2024 · 1 comment

Comments

@1943715762
Copy link

tdesign-mobile-vue 版本

1.2.3

重现链接

No response

重现步骤

问题:下拉刷新触发时机不对。滑动过程中,会不停触发下拉刷新,导致卡顿,半天划不动
效果:
https://github.com/Tencent/tdesign-mobile-vue/assets/55580893/fd844efd-9d9b-4117-b7fe-e8d6629271ba

代码:完全复制官网demo代码,

<t-pull-down-refresh v-model="refreshing" @refresh="onRefresh">
<t-list :async-loading="loading" @scroll="onScroll">

{{ item }}



<script lang="ts" setup> import { ref, onMounted } from 'vue'; const MAX_DATA_LEN = 60; const loadData = (data: any, isRefresh?: Boolean) => { const ONCE_LOAD_NUM = 20; return new Promise((resolve) => { setTimeout(() => { const temp = []; for (let i = 0; i < ONCE_LOAD_NUM; i++) { if (isRefresh) { temp.push(`${i + 1}`); } else { temp.push(`${data.value.length + 1 + i}`); } } if (isRefresh) { data.value = temp; } else { data.value.push(...temp); } resolve(data); }, 1000); }); }; const listPull = ref([] as Array); const loading = ref(''); const refreshing = ref(false); const onLoadPull = (isRefresh?: Boolean) => { if ((listPull.value.length >= MAX_DATA_LEN && !isRefresh) || loading.value) { return; } loading.value = 'loading'; loadData(listPull, isRefresh).then(() => { loading.value = ''; refreshing.value = false; }); }; const onScroll = (scrollBottom: number) => { if (scrollBottom < 50) { onLoadPull(); } }; const onRefresh = () => { refreshing.value = true; onLoadPull(true); }; onMounted(() => { onLoadPull(); }); </script>

期望结果

在正确的位置触发下拉刷新,滑动时,丝滑不卡顿。

Uploading 1.mp4…

实际结果

只要是向上滑动,就触发下拉刷新

框架版本

vue3.2.47

浏览器版本

No response

系统版本

window11

Node版本

16.15.1

补充说明

普通的列表

Copy link
Contributor

github-actions bot commented Jun 6, 2024

👋 @1943715762,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant