ant-motion
ant-motion copied to clipboard
BannerAnimh获取wrapperHeight有问题
请看图,如果图片太大,太多,_this.dom.getElementsByClassName('banner-anim-elem')会获取不到dom节点,导致wrapperHeight为0,然后就导致了动画为黑屏
第一张图中的第一个红框为组件component自己渲染
第二个红框使用以下图中的方式渲染
在这里重新绘制了一次,就不会出现这个问题
希望改进一下
Translation of this issue:
BannerAnimh getting wrapperHeight problem
Look at the picture, if the picture is too large, too much, _this.dom.getElementsByClassName('banner-anim-elem') will not get the dom node, causing wrapperHeight to be 0, then causing the animation to be black
The first red box in the first picture renders the component component itself.
The second red box is rendered using the image below
Repainted here once, this problem will not occur
I hope to improve it.
你确定是图片过大的原因吗???能否提供下示例: https://codesandbox.io/s/42vvz4j4yx ?
或者你可以考虑在bg上加个高度。。
不好意思,代码就不贴了。再次仔细看了一下,不跟图片有关吧 bg上的高度也是加了的
在render上输出了一下
看图中,第一次render之后,就获取了wrapperHeight,
但是图片是异步加载的,Element初始的时候没有挂载进去,导致了_this.dom.getElementsByClassName('banner-anim-elem') 这个获取不到,所以不能得到wrapperHeight
顺便说一句,‘across’ 和 ‘vertical’不存在动画黑屏,其他效果存在黑屏
好吧,,我这边有时间再看一下,,,谢谢。。。