From b0613f3760f37de9db8b132788d95b2d97727feb Mon Sep 17 00:00:00 2001 From: linxi Date: Mon, 24 Feb 2025 16:26:37 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A3285=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E7=94=A8=E6=88=B7=E6=98=B5?= =?UTF-8?q?=E7=A7=B0=E6=9C=89=E4=B8=A4=E8=A1=8C=E6=97=B6=EF=BC=8C=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=9C=BA=E5=9E=8B=E7=9A=84=E3=80=90=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E3=80=91=E6=8C=89=E9=92=AE=E8=B6=85=E5=87=BA?= =?UTF-8?q?=E4=BA=86=E7=BA=A2=E8=89=B2=E5=8C=BA=E5=9F=9F=EF=BC=88=E6=9C=BA?= =?UTF-8?q?=E5=9E=8B=EF=BC=9A=E8=8B=B9=E6=9E=9C12=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/User/index.vue | 43 +++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/pages/user/User/index.vue b/pages/user/User/index.vue index fe20d78..b851d0c 100644 --- a/pages/user/User/index.vue +++ b/pages/user/User/index.vue @@ -39,18 +39,20 @@ class="vip" /> - - - 会员码 - - - - - 设置中心 - + + + + 会员码 + + + + + 设置中心 + + @@ -356,7 +358,8 @@ export default { ], bannerBgUrl: '', userCenterBannerUrl: '', - pageKeyId: Object.freeze('userIndex') + pageKeyId: Object.freeze('userIndex'), + nowrap: true } }, computed: mapGetters(['userInfo']), @@ -388,6 +391,19 @@ export default { }, methods: { ...mapMutations(['updateAuthorizationPage']), + // 新增方法:计算文本像素长度 + getTextWidth() { + this.$nextTick(() => { + const query = uni.createSelectorQuery().in(this); + query.select('.txt-cont').boundingClientRect(data => { + console.log(data, 'data'); + if (data) { + this.nowrap = data.width < 200; + return data.width; + } + }).exec(); + }) + }, handleSwiper(e) { const url = this.userCenterCarousel[e].url this.linkTo(url) @@ -463,6 +479,7 @@ export default { const _this = this getUserLevelInfo().then((res) => { if (res.data) { + _this.getTextWidth() _this.userLevelInfo = res.data } uni.hideLoading()