diff --git a/pages/gamll/index.vue b/pages/gamll/index.vue index 58a96dd..f8b9aef 100644 --- a/pages/gamll/index.vue +++ b/pages/gamll/index.vue @@ -3,8 +3,10 @@ - - + + + + @@ -20,7 +22,7 @@ - + @@ -267,9 +269,11 @@ retail: '', wholesale: '', scrollTop: 0, + heightTop:136, } }, onLoad() { + this.retail = uni.getStorageSync('userInfo').retail this.getRetailList() this.getDescribe() @@ -279,7 +283,8 @@ uni.$off('appShow', this.solveShowMsg); }, onShow() { - this.checkIfElementIsAtTop() + let that = this + that.checkIfElementIsAtTop() }, onPageScroll(e) { this.scrollTop = e.scrollTop > 120 ? true : false @@ -290,11 +295,16 @@ } }, methods: { + pxToRpx(px) { + const screenWidth = uni.getSystemInfoSync().screenWidth //窗口宽度 + let rpx = (750 * Number.parseInt(px)) / screenWidth //转换单位为rpx + return Number(rpx) + }, checkIfElementIsAtTop() { const query = uni.createSelectorQuery().in(this); - query.select('u-navbar ').boundingClientRect(data => { + query.select('.navbarHeight ').boundingClientRect(data => { if (data) { - console.log(data, 'kkkkkkkkkkkkkkkkk') + this.heightTop=this.pxToRpx(data.height) } }).exec(); },