sambernard / react-preload

Component to preload images before showing content
MIT License
148 stars 48 forks source link

add getProgress feature #30

Open YanYuanFE opened 6 years ago

YanYuanFE commented 6 years ago
_getProgress = (completedCount, total) => {
        const percent = (Math.round(completedCount/total * 10000)/100).toFixed(2) + '%'
        console.log(percent)
    }
<Preload

                images={images}
                onError={this._handleImageLoadError}
                onSuccess={this._handleImageLoadSuccess}
                getProgress={this._getProgress}
                mountChildren
                resolveOnError
            >
const propTypes = {
    // getProgress
    getProgress: PropTypes.func,
}
diedu89 commented 6 years ago

@sambernard any news on this PR?

YanYuanFE commented 6 years ago

增加了加载图片获取进度的功能,修改了一些开发时的代码