WeChat Mini Programs, how to get the width and height of a custom component?

such as the title.
or can only be obtained through events?
Thank you!

Dec.28,2021

for example, getSize () is a method under dialog.js , where D2 is the id value of the custom component
clipboard.png

dialog
clipboard.png

dialoggetSize()
clipboard.png
clipboard.png

clipboard.png

Menu