How to set picture width and height asynchronously by weex custom picture component

the image component that comes with

weex must have width and height set to display.
such as

<image style="widht:100px;height:100px;" src="https://img.codeshelper.com/upload/img/2021/03/28/q2o24511bmg13874.png"></image>

I want to write a picture component with ios and android. After the picture is loaded successfully, I set the width and height, of the component according to the actual size of the picture, but it doesn"t work.

see that there is a setNeedsLayout method, and calling it has no effect.

Mar.28,2021
Bind the load event to

image to get the width and height of the picture, and then set the width and height of the picture by this.$refs


solve it yourself. It's really difficult to use


how to solve it?

Menu