获取到当前设备的宽度和高度
uni.getSystemInfo({
success: function (res) {
console.log(res.windowHeight)
console.log(res.windowWidth)
}
})
当前元素距离顶部的距离
uni.createSelectorQuery().select('.your-selector')
.boundingClientRect(function(rect){
console.log(rect.top); // 元素上边距离屏幕顶部的高度
}).exec();