We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
微信小程序
小程序基础库: 2.14.1 使用框架: React
// 用class写app.js可以使用生命周期:
class App extends React.component {
componentDidMount() { console.log('app mounted') } componentDidShow() { console.log('app showed') } render() { return ( <Provider store={store}> {this.props.children} </Provider> ) }
}
// >> app mounted
// >> app showed
// 用函数写法,使用Taro的hooks无效:
const App = props => {
useEffect(() => { console.log('app mounted') }, []) useDidShow(() => { console.log('app showed') }) return ( <Provider store={store}> {this.props.children} </Provider> )
// 期望结果是可以打印出 app showed
在app.js里面用class写的话componentDidShow是没问题的,换成函数形式写用useDidShow就没有触发。但是在pages里面的页面用useDidShow都是没问题的,想问一下这个是Taro本身的问题还是哪里没写对?
在app.js中正常使用Taro的hooks (useDidShow, useDidHide等)
Taro CLI 3.0.18 environment info: System: OS: Windows 10 Binaries: Node: 14.15.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.10 - C:\Users\XXX\AppData\Roaming\npm\yarn.CMD npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
The text was updated successfully, but these errors were encountered:
遇到了同样的问题,函数组件没有触发执行
Sorry, something went wrong.
fix(runtime): 修复 app 不能使用Show/Hide钩子的问题,fix #8348
ac908da
fix(runtime): 修复 app 不能使用Show/Hide钩子的问题,fix #8348 (#8430)
8a4bf12
* fix(runtime): 修复 app 不能使用Show/Hide钩子的问题,fix #8348 * fix: ci
我也出现了,3.1.5版本
3.5.6 再次复现,app.tsx里面 useDidShow 不生效,pages里面的可以 @Chen-jj
Successfully merging a pull request may close this issue.
相关平台
微信小程序
小程序基础库: 2.14.1
使用框架: React
复现步骤
// 用class写app.js可以使用生命周期:
class App extends React.component {
}
// >> app mounted
// >> app showed
// 用函数写法,使用Taro的hooks无效:
const App = props => {
}
// >> app mounted
// 期望结果是可以打印出 app showed
期望结果
在app.js里面用class写的话componentDidShow是没问题的,换成函数形式写用useDidShow就没有触发。但是在pages里面的页面用useDidShow都是没问题的,想问一下这个是Taro本身的问题还是哪里没写对?
实际结果
在app.js中正常使用Taro的hooks (useDidShow, useDidHide等)
环境信息
The text was updated successfully, but these errors were encountered: