let _this=this let height="" const query = uni.createSelectorQuery() query.select('#u-dropdown').boundingClientRect() query.selectViewport().scrollOffset() query.exec(function(res){ // debugger res[0].top // #the-id节点的上边界坐标 res[1].scrollTop // 显示区域的竖直滚动位置 // _this.height=res.windowHeight-res[0].top +'px' // =_this.height height=uni.getSystemInfoSync().screenHeight _this.viewHeight=height-res[0].top-res[0].height _this.contentStyle={ zIndex: -1, opacity: 0, height:_this.viewHeight+'px' } // console.log('打印高度',_this.viewHeight); // console.log('打印demo的元素的信息',res); }) }