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

"@tarojs/components": "1.3.29" 图片组件bug #5076

Closed
heshuai326 opened this issue Dec 13, 2019 · 6 comments
Closed

"@tarojs/components": "1.3.29" 图片组件bug #5076

heshuai326 opened this issue Dec 13, 2019 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@heshuai326
Copy link

heshuai326 commented Dec 13, 2019

问题描述

image

复现步骤

"@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

@taro-bot
Copy link

taro-bot bot commented Dec 13, 2019

CC @Littly

@taro-bot
Copy link

taro-bot bot commented Dec 13, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Garfield550
Copy link
Collaborator

这是 #4975 修改时的疏忽,@Lostsory 麻烦您再提交一个 PR 修改一下吧

@Garfield550 Garfield550 added the bug Something isn't working label Dec 13, 2019
@Lostsory
Copy link

Lostsory commented Dec 13, 2019 via email

@Garfield550
Copy link
Collaborator

重启一下 CI,过了就合并一下。

@Littly
Copy link
Contributor

Littly commented Dec 27, 2019

1.3.32版本中已经修复

@Littly Littly closed this as completed Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants