测量 ele 元素相对于 target 元素的顶部和左侧位置:

// 获取两个元素距视口的坐标
const eleRect = ele.getBoundingClientRect()
const targetRect = ele.getBoundingClientRect()

// 计算顶部和左侧的位置
const top = eleRect.top - targetRect.top
const left = eleRect.left - targetRect.left