Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taro-vue3使用useReachBottom在切换页面返回后会多次执行 #11504

Closed
vipterry opened this issue Mar 23, 2022 · 9 comments · Fixed by #12453
Closed

taro-vue3使用useReachBottom在切换页面返回后会多次执行 #11504

vipterry opened this issue Mar 23, 2022 · 9 comments · Fixed by #12453
Labels
F-vue3 Framework - Vue 3 T-h5 Target - 编译到 H5 V-3 Version - 3.x wonfix 不会修复(这可能并非是一个问题)

Comments

@vipterry
Copy link

相关平台

H5

复现仓库

https://github.com/vipterry/taro-reach-bottom.git
浏览器版本: Chrome 99
使用框架: Vue 3

复现步骤

进入首页后,下拉到底部,点击“个人中心”,然后点击返回按钮,这个时候重复下拉到底部,会多次执行(来回多少次就会触发多少次执行)

期望结果

只触发一次

实际结果

触发N次

环境信息

Taro CLI 3.4.2 environment info:
    System:
      OS: macOS 11.6.4
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 12.21.0 - ~/.nvm/versions/node/v12.21.0/bin/node
      npm: 6.14.11 - ~/.nvm/versions/node/v12.21.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.4.2 => 3.4.2 
      @tarojs/components: 3.4.2 => 3.4.2 
      @tarojs/mini-runner: 3.4.2 => 3.4.2 
      @tarojs/runtime: 3.4.2 => 3.4.2 
      @tarojs/taro: 3.4.2 => 3.4.2 
      @tarojs/webpack-runner: 3.4.2 => 3.4.2 
      babel-preset-taro: 3.4.2 => 3.4.2 
      eslint-config-taro: 3.4.2 => 3.4.2 
@taro-bot2 taro-bot2 bot added F-vue3 Framework - Vue 3 T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Mar 23, 2022
@github-actions
Copy link
Contributor

@vipterry
Copy link
Author

image

@ZakaryCode
Copy link
Contributor

多次触发是合理的,如果需要限制触发次数可以自己配置截流。使用lodash或者自己实现都可以。

@ZakaryCode ZakaryCode added wonfix 不会修复(这可能并非是一个问题) to be closed labels Mar 23, 2022
@vipterry
Copy link
Author

多次触发是合理的,如果需要限制触发次数可以自己配置截流。使用lodash或者自己实现都可以。

这里是一次性触发了的,不是限流的问题

@taro-bot2
Copy link

taro-bot2 bot commented Mar 23, 2022

Hello~

这个问题由于客观原因不会被修复,如果没有更多的问题这个 issue 将在 7 天后被自动关闭。

如果您在这 7 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@taro-bot2 taro-bot2 bot removed the to be closed label Mar 24, 2022
@vipterry
Copy link
Author

问题排查思路:
1、根据小程序的逻辑,navigateBack 从B返回页面A,A的onload是不会被触发的。
2、当H5环境的下,以上条件的,onload被触发导致重复绑定。
image

@taro-bot2
Copy link

taro-bot2 bot commented Mar 24, 2022

Hello~

这个问题由于客观原因不会被修复,如果没有更多的问题这个 issue 将在 7 天后被自动关闭。

如果您在这 7 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@vipterry
Copy link
Author

继续提问题,由于每个页面都会调用一次,bindPageScroll进行绑定,从代码上看,有尝试移除,但是此时pageScrollFn保存的是下一个页面的函数,移除又怎么可能会成功呢? 所以问题就是出在这里。。。
image
image

@taro-bot2
Copy link

taro-bot2 bot commented Mar 25, 2022

Hello~

这个问题由于客观原因不会被修复,如果没有更多的问题这个 issue 将在 7 天后被自动关闭。

如果您在这 7 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue3 Framework - Vue 3 T-h5 Target - 编译到 H5 V-3 Version - 3.x wonfix 不会修复(这可能并非是一个问题)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants