为什么scroll-view中的bindscroll不触发

发布于 6 年前作者 lujuan12503 次浏览最后编辑 6 年前来自 ask

想用scroll-view写一个搜索框遇到顶部后固定不动 不知道为什么bindscroll死活触发不了 也不报错

wxml

<scroll-view style=“height: 100%” bindscroll=“scrollHhd”>

  <view style=‘background: red; height:200rpx;’></view>

  <view style=‘height:1200rpx;’></view>

</scroll-view>

js

Page({

  scrollHhd(e) {

    console.log(e)

  }

})

1 回复
yinxiulan
yinxiulan1 楼4 年前

scroll-y=“true” 看看?  如果不行的话  加上这个 upper-threshold = “100rpx”