收藏
回答

scroll-view组件下拉过快的话,scroll事件无法灵敏监听?导致数据不能及时响应

在滑动事件中,监听滑动距离,如果距离大于0,那么istop=false,若是滑动距离为0,那么istop=true

通过这个变量控制元素顶部导航栏的隐藏显示,结果快速滑动后 事件监听就不灵敏了,出现本该隐藏的元素在页面出现

如何解决,看了很多帖子都有这个现象,2022了还没解决吗官方

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

8 个回答

  • Demons
    Demons
    2023-01-14

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

    2023-01-14
    有用
    回复 1
    • 404
      404
      2023-01-14
      代码已在评论区
      2023-01-14
      回复
  • 冲呀
    冲呀
    2023-04-06

    +1, 安卓手机监听不灵敏

    2023-04-06
    有用 1
    回复 1
    • 冲呀
      冲呀
      2023-04-06
      2023年了,还没有解决么
      2023-04-06
      回复
  • 24
    24
    2023-08-22

    只安卓有这个问题,ios是没问题的


    2023-08-22
    有用
    回复
  • 🐨
    🐨
    2023-08-02

    快2024了还不肯解决吗

    2023-08-02
    有用
    回复
  • Hans🥣
    Hans🥣
    2023-03-06

    蹲 同样的问题

    2023-03-06
    有用
    回复
  • 赵晓宇
    赵晓宇
    2023-02-01

    蹲,同样的问题,快速滑动的时候bindscroll方法就没有调用,导致固定在顶部的导航栏tab消失不了,望尽快解决

    2023-02-01
    有用
    回复
  • 404
    404
    2023-01-14

    <template>

    <view class="inde">

    <scroll-view class="list_wrapper"   @scroll="scrollEvent" scroll-y="true">

    <view class="top_fixed" :style="{height:navHeight+'rpx',backgroundColor:istoggle?`#ffffff`:``,opacity:opacity}">

    <view class="top_fixed_wrapper" :style="{height:navigationBarHeight+'rpx',top:statusBarHeight+'rpx'}">

    <view class="nav_fixed"

    :style="{width:navFixedWidth,lineHeight:customHeight + 'rpx',paddingLeft:textPaddingLeft*scaleFactor+'rpx'}">

    <view :class="[istoggle?`nav_fixed_title_toggole`:`nav_fixed_item_title`]">

    <text style="margin-left:8rpx ;">果实坊</text>

    </view>

    <view class="nav_fixed_item_search" @click="turntosearch">

    <view :class="[istoggle?`nav_fixed_input_toggole`:`nav_fixed_item_input`]">

    <text class="iconfont " style="font-size: 35rpx;margin-left: 10rpx;">&#xe693;</text>

    <text style="font-size: 25rpx;margin-left: 5rpx; ">{{searchtitle}}</text>

    </view>

    </view>

    </view>

    </view>

    </view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    <view style="background-color: red;width: 100%;height: 200rpx">sssssssssssssss</view>

    </scroll-view>

    </view>

    </template>


    <script>

    export default {

    data() {

    return {

    istoggle:false

    }

    },

    methods: {

    scrollEvent(e) {

    console.log(e)

    var e=e.detail

    if (e.scrollTop <= 30) {

    this.istoggle = false

    this.opacity = 0

    }

    if (e.scrollTop > 30 && e.scrollTop <= 32) {

    this.istoggle = true

    this.opacity = 0.3

    }

    if (e.scrollTop > 32 && e.scrollTop <= 34) {

    this.istoggle = true

    this.opacity = 0.4

    }

    if (e.scrollTop > 34 && e.scrollTop <= 36) {

    this.istoggle = true

    this.opacity = 0.5

    }

    if (e.scrollTop > 36 && e.scrollTop <= 38) {

    this.istoggle = true

    this.opacity = 0.6

    }

    if (e.scrollTop > 38 && e.scrollTop <= 40) {

    this.istoggle = true

    this.opacity = 0.7

    }

    if (e.scrollTop > 40 && e.scrollTop <= 42) {

    this.istoggle = true

    this.opacity = 0.8

    }

    if (e.scrollTop > 46) {

    this.istoggle = true

    this.opacity = 1

    }

    },

    }

    }

    </script>


    <style>

    .index{

    width: 100%;

    height: 100%;

    }

    .list_wrapper{

    width: 100%;

    height: 100vh;

    }

    /* 固定导航栏整体部分(包括状态栏+导航栏) */

    .top_fixed {

    box-sizing: border-box;

    width: 100%;

    position: fixed;

    top: 0;

    left: 0;

    z-index: 10;

    }

    /* 导航栏部分(导航栏外层) */

    .top_fixed_wrapper {

    box-sizing: border-box;

    width: 100%;

    position: absolute;

    left: 0;

    display: flex;

    /* justify-content: center; */

    align-items: center;

    }

    /* 导航栏部分(导航栏内层:平齐胶囊部分) */

    .nav_fixed {

    box-sizing: border-box;

    width: 100%;

    top: 202rpx;

    z-index: 10;

    display: flex;

    flex-direction: row;

    align-items: center;

    justify-content: space-around;

    }

    /* 标题 */

    .nav_fixed_item_title {

    width: 30%;

    height: 100%;

    color: yellow;

    font-size: 40rpx;

    font-weight: bold;

    }

    /* 假搜索框外层 */

    .nav_fixed_item_search {

    width: 75%;

    height: 100%;

    margin-right: 10rpx;

    margin-left: 5rpx;

    font-size: 40rpx;

    font-weight: bold;

    }

    /* 假搜索框 */

    .nav_fixed_item_input {

    width: 100%;

    height: 100%;

    box-sizing: border-box;

    background-color: yellow;

    border-radius: 50rpx;

    color: #858992;

    display: flex;

    flex-direction: row;

    align-items: center;

    }

    /* 标题下拉fixed样式 */

    .nav_fixed_title_toggole {

    width: 30%;

    height: 100%;

    color: seagreen;

    font-size: 40rpx;

    font-weight: bold;

    }

    /* 假搜索框下拉fixed样式 */

    .nav_fixed_input_toggole {

    width: 100%;

    height: 100%;

    box-sizing: border-box;

    background-color: #ffffff;

    border-radius: 50rpx;

    color: #858992;

    display: flex;

    flex-direction: row;

    align-items: center;

    border: 4rpx solid seagreen;

    }

    </style>


    2023-01-14
    有用
    回复
  • Jianbo
    Jianbo
    2023-01-14

    代码贴出来看看

    2023-01-14
    有用
    回复 1
    • 404
      404
      2023-01-14
      代码已在评论区
      2023-01-14
      回复
登录 后发表内容