-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
"@tarojs/components": "1.3.29" 图片组件bug #5076
Labels
bug
Something isn't working
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
复现步骤
"@tarojs/components": "1.3.29" 图片组件bug
lazyImg会报undefined的错误,对比了1.3.26 版本发现有出入
1.3.29版本
componentDidMount () {
if (this.props.lazyLoad) {
this.observer = new IntersectionObserver((entries, observer) => {
// 异步 api 关系
if (entries[entries.length - 1].isIntersecting) {
this.setState({ isLoaded: true }, () => {
lazyImg.unobserve(this.imgRef)
Nerv.findDOMNode(this).children[0].src = this.props.src
})
}
}, {
rootMargin: '300px 0px'
})
this.observer.observe(this.imgRef)
}
}
1.3.26版本
componentDidMount () {
if (this.props.lazyLoad) {
const lazyImg = new IntersectionObserver((entries, observer) => {
// 异步 api 关系
if (entries[entries.length - 1].isIntersecting) {
this.setState({ isLoaded: true }, () => {
lazyImg.unobserve(this.imgRef)
Nerv.findDOMNode(this).children[0].src = this.props.src
})
}
}, {
rootMargin: '300px 0px'
})
lazyImg.observe(this.imgRef)
}
}
期望行为
在下一版本可以修复
报错信息
LazyImage is undefined
The text was updated successfully, but these errors were encountered: