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()