Closed L-x-C closed 1 year ago
H5
浏览器版本: chrome 100 使用框架: React
建2个页面
import Taro from '@tarojs/taro'; import React from 'react'; export default class Test1 extends React.Component { state = { }; componentDidHide() { console.log('hide11111') } componentDidShow() { } click() { Taro.navigateTo({ url: '/pages/test/index2' }) } render() { return ( <> <button id='box' onClick={this.click}>点击去Test2</button> </> ); } }
和
import Taro from '@tarojs/taro'; import React from 'react'; export default class Test2 extends React.Component { state = { }; componentDidHide() { console.log('hide2222') } componentDidShow() { } click() { Taro.navigateBack() } render() { return ( <> <button id='box' onClick={this.click}>点击返回Test1</button> </> ); } }
从Test1点击按钮跳去Test2,再从Test2返回
理论上应该触发hide11111和hide2222
实际只触发了hide11111
Taro CLI 3.0.21 environment info: System: OS: macOS 13.3.1 Shell: 5.9 - /bin/zsh Binaries: Node: 11.15.0 - ~/.nvm/versions/node/v11.15.0/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v11.15.0/bin/yarn npm: 6.7.0 - ~/.nvm/versions/node/v11.15.0/bin/npm npmPackages: @tarojs/cli: 3.6.6 => 3.6.6 @tarojs/components: 3.6.6 => 3.6.6 @tarojs/mini-runner: 3.6.6 => 3.6.6 @tarojs/react: 3.6.6 => 3.6.6 @tarojs/runtime: 3.6.6 => 3.6.6 @tarojs/taro: 3.6.6 => 3.6.6 @tarojs/webpack-runner: 3.6.6 => 3.6.6 babel-preset-taro: 3.6.6 => 3.6.6 eslint-config-taro: 3.6.6 => 3.6.6 react: ^16.10.0 => 16.14.0 taro-ui: 3.1.0-beta.4 => 3.1.0-beta.4 npmGlobalPackages: typescript: 5.0.2
页面2是被销毁了,实际不应该执行 hide 生命周期
相关平台
H5
浏览器版本: chrome 100 使用框架: React
复现步骤
建2个页面
和
从Test1点击按钮跳去Test2,再从Test2返回
期望结果
理论上应该触发hide11111和hide2222
实际结果
实际只触发了hide11111
环境信息