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

Tab页切换时componentWillUnmount钩子函数不触发,无法清除定时器 #12526

Closed
chenshuaifeng110 opened this issue Sep 20, 2022 · 1 comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@chenshuaifeng110
Copy link

相关平台

微信小程序

复现仓库

https://github.com/chenshuaifeng110/applet-service
小程序基础库: 2.23.4
使用框架: React

复现步骤

1.进入index页面,定时器开启
2.切换tab页,进入center页
3.index页面的onUnload钩子没有执行,定时器继续没有清理

期望结果

执行onUnload钩子函数

实际结果

没有执行,在非tab页执行了

环境信息

 Taro v3.3.14
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating

  Taro CLI 3.3.14 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.17.6 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.17 - C:\Users\chenshuaifeng\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 20, 2022
@TheKonka
Copy link
Member

仓库地址404了
tab 页面 是不会销毁的,所以不会执行 onUnload ,可以用useDidHide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

3 participants