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
if (this.url && this.url != this.props.url) { this.onchangeUrl() } 切换视频时报错,最后排查得到onchangeUrl 这个方法里面带有this.setState 而onchangeUrl 的调用位置却是在render处 这样会到导致死循环
if (this.url && this.url != this.props.url) { this.onchangeUrl() }
大佬要判断地址是否和上一次的一样 可以在生命周期componentDidUpdate 里完成哦
The text was updated successfully, but these errors were encountered:
说错了不应该是componentDidUpdate
应该是componentWillReceiveProps shouldComponentUpdate 都可以
componentWillReceiveProps(nextProps) { if (nextProps.url !== this.props.url) { this.onchangeUrl() } }
Sorry, something went wrong.
应该是不会死循环的,因为this.url和props的url不相同才会执行onchangeUrl方法;
当然最好的写法是在com生命周期里;
可以pr一波,我没有时间,最近项目太忙了;
No branches or pull requests
if (this.url && this.url != this.props.url) { this.onchangeUrl() }
切换视频时报错,最后排查得到onchangeUrl 这个方法里面带有this.setState
而onchangeUrl 的调用位置却是在render处 这样会到导致死循环
大佬要判断地址是否和上一次的一样 可以在生命周期componentDidUpdate 里完成哦
The text was updated successfully, but these errors were encountered: