uni-app highly adaptive

Method 1 Known fixed height
** Note that the initial value of scrollH is not equal to the height of the final display, if the component is encapsulated, onReady () **

    onLoad() {         // Obtain the height of the visible area, minus the fixed height         uni.getSystemInfo({             success: res => {                 this.scrollH = res.windowHeight - uni.upx2px(82);             }         });     }, method two Get fixed height dynamically









    onLoad() {         this.$nextTick(function() {             uni.getSystemInfo({                 success: res => {                     const query = uni.createSelectorQuery().in(this);                     query.select('#scrollH').boundingClientRect( data => {                             // this.scrollH = `${data.height}px;`; console.log                             (data.height)                         }).exec();                 }             });         })     ; package














Guess you like

Origin blog.csdn.net/m0_46461853/article/details/126896789