Skip to content

Commit

Permalink
fix(list): 修复非页面加载时重复下拉出现卡住加载动画
Browse files Browse the repository at this point in the history
  • Loading branch information
kyour-cn committed Jan 27, 2024
1 parent 02a0bee commit 98a04c6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/list/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import PuiLoading from '../loading'
import PuiEmpty from '../empty'
import {computed, ref, watch} from 'vue'
import {computed, ref, toRefs, watch} from 'vue'
import {usePetalUiStore} from "../../stores/petal-ui";
const puiStore = usePetalUiStore()
Expand Down Expand Up @@ -80,9 +80,11 @@ const pullingTopX = ref(0)
const onPulling = (e) => {
pullingTopX.value = Math.floor(e.detail.deltaY)
}
watch(loading, (val) => {
const { pullRefresh } = toRefs(props);
watch(pullRefresh, (val) => {
if (!val) {
// pullingTopX.value = 0
pullingTopX.value = 0
}
})
Expand All @@ -102,7 +104,7 @@ const scrollToUpper = () => {
:scroll-y="true"
:refresher-triggered="loading"
refresher-default-style="none"
:refresher-enabled="props.pullRefresh"
:refresher-enabled="pullRefresh"
:lower-threshold="props.offset"
:refresher-background="puiStore.theme['bg-page']"
@scrolltoupper="scrollToUpper"
Expand Down

0 comments on commit 98a04c6

Please sign in to comment.