From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期三, 05 三月 2025 17:29:42 +0800 Subject: [PATCH] - --- src/uni_modules/uview-plus/components/u-text/u-text.vue | 32 ++++++++++++++++++++------------ 1 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/uni_modules/uview-plus/components/u-text/u-text.vue b/src/uni_modules/uview-plus/components/u-text/u-text.vue index c3b50dd..d852eed 100644 --- a/src/uni_modules/uview-plus/components/u-text/u-text.vue +++ b/src/uni_modules/uview-plus/components/u-text/u-text.vue @@ -3,10 +3,7 @@ class="u-text" :class="[customClass]" v-if="show" - :style="{ - margin: margin, - justifyContent: align === 'left' ? 'flex-start' : align === 'center' ? 'center' : 'flex-end' - }" + :style="wrapStyle" @tap="clickHandler" > <text @@ -22,8 +19,9 @@ ></u-icon> </view> <u-link - v-if="mode === 'link'" class="u-text__value" - :style="{fontWeight: valueStyle.fontWeight, wordWrap: valueStyle.wordWrap, fontSize: valueStyle.fontSize}" :class="[ type && `u-text__value--${type}`, lines && `u-line-${lines}` ]" :text="value" + v-if="mode === 'link'" class="u-text__value" + :style="{fontWeight: valueStyle.fontWeight, wordWrap: valueStyle.wordWrap, fontSize: valueStyle.fontSize}" + :class="[type && `u-text__value--${type}`,lines && `u-line-${lines}`]" :text="value" :href="href" underLine ></u-link> @@ -115,6 +113,20 @@ // #endif emits: ['click'], computed: { + wrapStyle() { + let style = { + margin: this.margin, + justifyContent: this.align === 'left' ? 'flex-start' : this.align === 'center' ? 'center' : 'flex-end' + } + // 鍗犳弧鍓╀綑绌洪棿 + if (this.flex1) { + style.flex = 1; + // #ifndef APP-NVUE + style.width = '100%'; + // #endif + } + return style; + }, valueStyle() { const style = { textDecoration: this.decoration, @@ -149,14 +161,14 @@ }, methods: { addStyle, - clickHandler() { + clickHandler(e) { // 濡傛灉涓烘墜鏈哄彿妯″紡锛屾嫧鎵撶數璇� if (this.call && this.mode === 'phone') { uni.makePhoneCall({ phoneNumber: this.text }) } - this.$emit('click') + this.$emit('click', e) } } } @@ -169,10 +181,6 @@ @include flex(row); align-items: center; flex-wrap: nowrap; - flex: 1; - /* #ifndef APP-NVUE */ - width: 100%; - /* #endif */ &__price { font-size: 14px; -- Gitblit v1.9.1