Closed aidening closed 5 years ago
我也是啊。。。滚动到那个位置就是没有数据 也用了antd-mobile,不过我不是在antd-mobile组件中做的懒加载,就是平常的组件中,滑动到那个位置也没有加载数据 一直是placeholder
我的问题已经解决了,我之所以滑动滚动条没有数据加载出来,只是占位符,是因为:我需要懒加载的元素处于一个div下,没有被加载的子元素实际上是溢出的,不能直接向使用图片懒加载那样直接使用Lazyload,需要在父层div添加叫overflow的class,在子元素上引用的Lazyload组件上也加上overflow属性即可实现滑动滚动条也有数据了
可是我的还是没有解决啊 就是一直是placeholder 能加className 为 overflow的地方都加了
import React from 'react'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { AsyncKingKongModule } from '../../../redux-file/actions-creators'
import { Toast } from 'antd-mobile';
import './index.less'
import LazyLoad from 'react-lazyload';
function loadingToast() {
Toast.loading('Loading...', .5, () => {
});
}
class App extends React.Component {
componentDidMount() {
this.props.reqKingKongModule()
}
handleClick = (item) => {
return () => {
loadingToast()
setTimeout(() => {
this.props.history.push({ pathname: '/shop', state: { data: item } })
}, 500)
}
}
render() {
const { KingkongModule } = this.props
return (
<div className="KingkongModule overflow" >
{KingkongModule.map((item, index) => {
return <div onClick={this.handleClick(item)} className="kingkong-item overflow" key={`${index + 10}`}>
<LazyLoad height={200} offset={-100} className="overflow">
<img src={item.picUrl} alt="" className="overflow"/>
</LazyLoad>
<span>{item.text}</span></div>
})}
</div >
)
}
}
export default withRouter(connect(
(state) => ({ KingkongModule: state.KingKong }),
(dispatch) => ({
reqKingKongModule() {
const action = AsyncKingKongModule();
dispatch(action)
},
})
)(App))
解决 了 谢谢
解决 了 谢谢
你的问题是出在哪里啊,我也是遇到了同样的问题,但是还没解决
@JinJieTan and @solvep do you both still facing problems?
@JinJieTan and @solvep do you both still facing problems? ths,I solved it
Cool I will close the issue now feel free to open it again if you face similar problem
我滚动条向下滚动时,没有数据加载,我是在antd table的每一个column列下的render函数内使用的LazyLoad包裹return的内容,但是滑动滚动条并没有数据加载