From 00acb054f6364889754c92ad39ffc5fd7c9f9c61 Mon Sep 17 00:00:00 2001 From: fanfan Date: Sun, 4 Aug 2024 13:22:03 +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 | 48 +++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/pages/gamll/index.vue b/pages/gamll/index.vue index ef24618..58a96dd 100644 --- a/pages/gamll/index.vue +++ b/pages/gamll/index.vue @@ -3,7 +3,7 @@ - + - - - - - {{item}} + + + + + + {{item}} + - + @@ -238,7 +240,6 @@ paymentMethods: [], isClick: true, radius: '28rpx 0 0 0', - paddingTo: '0rpx', leftNum: 33.33333, tabbar: ['零售商城', '批发商城'], tabIndex: 0, @@ -266,12 +267,10 @@ retail: '', wholesale: '', scrollTop: 0, - isAtTop: '' } }, onLoad() { this.retail = uni.getStorageSync('userInfo').retail - console.log(this.retail) this.getRetailList() this.getDescribe() uni.$on('appShow', this.solveShowMsg); @@ -280,25 +279,22 @@ uni.$off('appShow', this.solveShowMsg); }, onShow() { - + this.checkIfElementIsAtTop() }, onPageScroll(e) { - this.checkIfElementIsAtTop() + this.scrollTop = e.scrollTop > 120 ? true : false + if (this.scrollTop) { + this.radius = '0rpx'; + } else { + this.radius = this.tabIndex == 0 ? '28rpx 0 0 0' : '0 28rpx 0 0'; + } }, methods: { checkIfElementIsAtTop() { const query = uni.createSelectorQuery().in(this); - query.select('.tab_fix').boundingClientRect(data => { + query.select('u-navbar ').boundingClientRect(data => { if (data) { - // 元素的top值如果是0,说明它到达了顶部 - this.isAtTop = data.top === 0; - if (this.isAtTop) { - this.radius = '28rpx 0 0 0'; - this.paddingTo = '120rpx'; - } else { - this.radiu = '0'; - this.paddingTo = '0rpx'; - } + console.log(data, 'kkkkkkkkkkkkkkkkk') } }).exec(); }, @@ -720,10 +716,7 @@ .tab_fix { overflow: hidden; - position: -webkit-sticky; - position: sticky; - top: 0; - z-index: 99999; + height: 126rpx; background: linear-gradient(180deg, rgba(253, 202, 197, 1) 0.42%, rgba(254, 231, 229, 1) 32.99%, rgba(255, 255, 255, 1) 100%); } @@ -875,6 +868,7 @@ .tab-box { margin: 10rpx 30rpx 24rpx 30rpx; overflow: hidden; + .tabFavour { display: flex; justify-content: space-between;