From e402364ffd804694462a2b5ee015a25a0efc2d4a Mon Sep 17 00:00:00 2001 From: fanfan Date: Sun, 4 Aug 2024 13:46:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/gamll/index.vue | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) 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(); },