收藏
回答

scroll-view滚动到底部有时候不触发scrolltolower事件需要上滑一下才能继续触发?

scroll-view滚动到底部有时候不触发scrolltolower事件,会出现卡死的情况 安卓大部分机型 都可以滑出来 华为mete30pro比较容易触发
下面是组件代码
<template>
  <scroll-view
    class="i-scroll-view"
    :style="scrollStyle"
    scroll-y
    refresher-enabled
    :refresher-triggered="refresherTrigger"
    @refresherrefresh="onRefresherpulling"
    @scrolltolower="emits('scrolltolower')"
    lower-threshold="150"
  >
    <view>
      <slot />
      <iLoadMore v-if="props.showLoadMore" :status="props.status" :nodataText="nodataText" :nomoreText="nomoreText" />
    </view>
  </scroll-view>
</template>

<script setup lang="ts">
import { ref } from "vue"
import iLoadMore from "@/components/iLoadMore/index.vue"

// 定义组件的参数及默认值
const props = defineProps({
  scrollStyle: {
    type: String,
    default: ''
  },
  status: {
    type: String,
    default: 'loading'
  },
  showLoadMore: {
    type: Boolean,
    default: true
  },
  nodataText: {
    type: String,
    default: ''
  },
  nomoreText: {
    type: String,
    default: '没有更多宝贝了~'
  }
})

// 触发回调函数
const emits = defineEmits(['onPulling', 'scrolltolower'])
// 控制下拉刷新的开关
const refresherTrigger = ref<boolean>(false)

// 下拉触发
async function onRefresherpulling() {
  // 打开下拉刷新状态
  refresherTrigger.value = true
  // 触发回调
  emits('onPulling', function() {
    // 收起下拉刷新状态
    refresherTrigger.value = false
  })
}
</script>


回答关注问题邀请回答
收藏

1 个回答

  • Demons
    Demons
    2022-07-12

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    2022-07-12
    有用
    回复
登录 后发表内容