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

升级到 0.0.64,所有的组件传 props 都失效了。 #256

Closed
songkeys opened this issue Jul 3, 2018 · 4 comments · Fixed by #15536
Closed

升级到 0.0.64,所有的组件传 props 都失效了。 #256

songkeys opened this issue Jul 3, 2018 · 4 comments · Fixed by #15536

Comments

@songkeys
Copy link
Contributor

songkeys commented Jul 3, 2018

问题描述
更新了 0.0.64 后,发现在 weapp 中,所有的组件传 props 都失效了。无论传变量还是常量,子组件的 componentWillReceiveProps 就是不触发。把依赖全部回退到 0.0.63 又可以正常编译了。

复现步骤
因为项目已经写了有一阵子了,不大清楚具体是哪里的代码导致了问题。
在原项目里,注释掉其他干扰代码,仅在根组件里尝试传一个 prop 给某个子组件,依旧无效。
暂时没有尝试新建项目复现。

可能是这次更新后的 dynamicComponents 导致的?

系统信息

  • 操作系统: Mac OS
  • Taro 版本 0.0.64
  • Node.js 版本 10.5.0
@zacksleo
Copy link
Contributor

zacksleo commented Jul 3, 2018

刚在群里问了,答曰:

嗯嗯,先回退,正在解决

@songkeys
Copy link
Contributor Author

songkeys commented Jul 3, 2018

@zacksleo
好的!非常感谢。我看没有人提 issue,以为是个例,差点折腾半天。
开发人员们也辛苦了。

@yuche
Copy link
Contributor

yuche commented Jul 4, 2018

麻烦试一下 0.0.67,应该能解决这个问题

@songkeys
Copy link
Contributor Author

songkeys commented Jul 4, 2018

@yuche 谢谢!试了一下 0.0.67。大部分问题都解决了。唯一出现的报错提示是:

发现问题可能是新的组件化方案导致传 props 的问题,
我在 render() 中写:

const { userInfo = {} } = this.state
return <Avatar src={userInfo.avatarUrl} />

会提示 userInfo is not defined. 但是写成:

return <Avatar src={this.state.userInfo.avatarUrl} />

就没有这个错误。

#261 #264

不过这个 issue 可以关闭了,谢谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants