for example, if you click an icon on the page, do you want to get the position of the current icon from the screen?
in Mini Program"s event object, there are currentTarget.offsetLeft
and currentTarget.offsetTop
, but this is the offset of the current component of the event binding from the parent container ( target.offsetLeft
similar)
there are detail.x
and detail.y
, but this is the coordinate of the hot spot, which means, for example, if you click on the upper left corner and the lower right corner of the icon, then the two coordinates are not the same.