获取点击元素的绝对位置

const rect = e.target.getBoundingClientRect()
this.setState({
shareTop: rect.top,
shareLeft: rect.left + 80
})
原文地址:https://www.cnblogs.com/LP1204/p/9837279.html