problem description
The height of theantd-mobile carousel component is very small when initialized, and it will display normally only when you switch to the second picture. What should I do with it?
the environmental background of the problems and what methods you have tried
- I set the style in element a with the class name, and there is no problem of giving a fixed height. However, since it is a mobile development, the width of the device is uncertain, and the focus map should be adaptive, so its height cannot be written down.
- I get these an elements with ref and set the height for them in componentDidMount. If you write it to a fixed value, you can see that the height setting is successful in F12, but the problem still exists. If the height is calculated from the aspect ratio of the picture and the width of the focus map, the setting is invalid.
- set frameOverflow= "visible" to carousel. After loading, you can see the complete first picture, but at this time the screen can swipe to the right to see all the focus images. A setHeight method is written in the
- component, which is called in the inline style of element a, and it doesn"t work.
related codes
/ / Please paste the code text below (do not replace the code with pictures)