feat: 解决在微信浏览器中下拉刷新整个被拖动,无法触发touch下拉刷新问题

master
LCJ-MinYa 5 months ago
parent 15908d0543
commit 082b46db3f

@ -0,0 +1,12 @@
// composables/useBodyClass.js
import { onMounted, onUnmounted } from 'vue';
export function useBodyClass(className) {
onMounted(() => {
document.body.classList.add(className);
});
onUnmounted(() => {
document.body.classList.remove(className);
});
}

@ -32,6 +32,10 @@ body {
text-rendering: optimizelegibility; text-rendering: optimizelegibility;
} }
body.body-overflow-hidden {
overflow: hidden;
}
hr { hr {
height: 0; height: 0;
color: inherit; color: inherit;

@ -27,6 +27,9 @@
<script setup lang="jsx"> <script setup lang="jsx">
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'; import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue';
import { debounce } from '@pureadmin/utils'; import { debounce } from '@pureadmin/utils';
import { useBodyClass } from '@/hooks/useBodyClass';
useBodyClass('body-overflow-hidden');
const boxRef = ref(null); const boxRef = ref(null);
const contentRef = ref(null); const contentRef = ref(null);
@ -67,7 +70,7 @@ const handleTouchmove = (e) => {
handleTouchend(); handleTouchend();
} }
}; };
const debounceHandleTouchmove = debounce(handleTouchmove, 500); const debounceHandleTouchmove = debounce(handleTouchmove, 100);
const handleTouchend = () => { const handleTouchend = () => {
if (loading.value) { if (loading.value) {
getData(); getData();

Loading…
Cancel
Save