<scroll-view @scroll="myScroll" @scrolltolower="scrollHandle" :lower-threshold="500">中lower-threshold失效触发不了scrolltolower和scroll事件怎办
时间: 2023-07-06 10:36:47 浏览: 60
如果在 `scroll-view` 组件中设置了 `lower-threshold` 属性,但是 `scrolltolower` 事件没有触发,那么可能是因为设置的阈值不够大。可以尝试增大阈值,或者检查是否有其他因素影响了事件的触发,比如是否设置了 `scroll-view` 的高度等。
同时,如果 `scroll` 事件也没有触发,可以检查是否在 `scroll-view` 上设置了 `overflow-y: scroll` 样式,或者是否包含了足够多的子元素以使滚动条出现。另外,也可以尝试在 `scroll-view` 上设置 `touchmove` 事件监听来检查是否能够监听到滚动事件。
相关问题
<scroll-view @scrolltolower="scrollHandle" :lower-threshold="500">中lower-threshold失效触发不了scrolltolower事件怎办
出现这种情况可能是因为你设置的 `lower-threshold` 值过小,导致无法满足触发 `scrolltolower` 事件的条件。可以尝试将 `lower-threshold` 值增大一些,或者检查一下是否存在其他因素影响了滚动区域的高度,导致无法触发事件。另外,还可以尝试在 `scroll-view` 上添加 `scroll` 事件监听器,查看具体滚动事件的触发情况,以便更好地诊断问题所在。
<scroll-view style="overflow-y: scroll;" @scroll="myScroll" @touchmove="scrollHandle"" @scrolltolower="scrollHandle" :lower-threshold="500">中lower-threshold失效触发不了scrolltolower和scroll事件只有touchmove触发怎办
在你提供的代码中,`scroll-view` 元素的样式设置为 `overflow-y: scroll`,这意味着当内容超出容器高度时,会显示纵向滚动条。但是,如果你的内容高度不足以触发滚动条,那么 `scroll`, `scrolltolower` 事件就不会被触发。
你可以检查一下 `scroll-view` 元素的高度是否正确,以及其内部元素的高度是否超出了容器高度。如果高度不够,你可以通过增加元素高度或者设置 `min-height` 等方式来增加高度。如果元素高度已经足够,但是事件仍然无法被触发,你可以尝试调整 `lower-threshold` 的值来触发 `scrolltolower` 事件。另外,你可以尝试添加一些调试代码,打印一些变量的值,以帮助你找到问题所在。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)