uview-plus 3.1.52 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +44 -0
- package/components/u-action-sheet/u-action-sheet.vue +1 -1
- package/components/u-album/u-album.vue +261 -261
- package/components/u-avatar/u-avatar.vue +3 -2
- package/components/u-avatar-group/u-avatar-group.vue +106 -106
- package/components/u-button/u-button.vue +6 -1
- package/components/u-calendar/u-calendar.vue +4 -3
- package/components/u-cell/u-cell.vue +4 -2
- package/components/u-checkbox/props.js +5 -0
- package/components/u-checkbox/u-checkbox.vue +27 -15
- package/components/u-code/u-code.vue +1 -1
- package/components/u-dropdown/props.js +8 -14
- package/components/u-dropdown/u-dropdown.vue +202 -77
- package/components/u-dropdown-item/props.js +45 -36
- package/components/u-dropdown-item/u-dropdown-item.vue +121 -148
- package/components/u-form/u-form.vue +1 -1
- package/components/u-form-item/props.js +6 -1
- package/components/u-form-item/u-form-item.vue +1 -1
- package/components/u-grid/u-grid.vue +4 -2
- package/components/u-grid-item/u-grid-item.vue +8 -7
- package/components/u-input/u-input.vue +1 -1
- package/components/u-lazy-load/u-lazy-load.vue +251 -0
- package/components/u-picker/u-picker.vue +4 -1
- package/components/u-popup/u-popup.vue +1 -1
- package/components/u-read-more/u-read-more.vue +164 -160
- package/components/u-slider/u-slider.vue +6 -6
- package/components/u-steps-item/u-steps-item.vue +318 -318
- package/components/u-subsection/u-subsection.vue +14 -8
- package/components/u-swiper/u-swiper.vue +6 -8
- package/components/u-tabs/u-tabs.vue +1 -0
- package/components/u-tag/props.js +5 -2
- package/components/u-text/u-text.vue +226 -226
- package/components/u-textarea/u-textarea.vue +275 -275
- package/components/u-transition/u-transition.vue +1 -1
- package/components/u-waterfall/u-waterfall.vue +225 -0
- package/libs/config/props/formItem.js +1 -0
- package/libs/config/props/tag.js +30 -29
- package/libs/css/common.scss +1 -1
- package/libs/css/components.scss +5 -5
- package/libs/css/flex.scss +45 -45
- package/libs/mixin/mixin.js +2 -2
- package/package.json +1 -1
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
:style="[barStyle]"
|
|
12
12
|
:class="[
|
|
13
13
|
mode === 'button' && 'u-subsection--button__bar',
|
|
14
|
-
|
|
14
|
+
innerCurrent === 0 &&
|
|
15
15
|
mode === 'subsection' &&
|
|
16
16
|
'u-subsection__bar--first',
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
innerCurrent > 0 &&
|
|
18
|
+
innerCurrent < list.length - 1 &&
|
|
19
19
|
mode === 'subsection' &&
|
|
20
20
|
'u-subsection__bar--center',
|
|
21
|
-
|
|
21
|
+
innerCurrent === list.length - 1 &&
|
|
22
22
|
mode === 'subsection' &&
|
|
23
23
|
'u-subsection__bar--last',
|
|
24
24
|
]"
|
|
@@ -83,6 +83,7 @@ export default {
|
|
|
83
83
|
width: 0,
|
|
84
84
|
height: 0,
|
|
85
85
|
},
|
|
86
|
+
innerCurrent: ''
|
|
86
87
|
};
|
|
87
88
|
},
|
|
88
89
|
watch: {
|
|
@@ -92,6 +93,9 @@ export default {
|
|
|
92
93
|
current: {
|
|
93
94
|
immediate: true,
|
|
94
95
|
handler(n) {
|
|
96
|
+
if (n !== this.innerCurrent) {
|
|
97
|
+
this.innerCurrent = n
|
|
98
|
+
}
|
|
95
99
|
// #ifdef APP-NVUE
|
|
96
100
|
// 在安卓nvue上,如果通过translateX进行位移,到最后一个时,会导致右侧无法绘制圆角
|
|
97
101
|
// 故用animation模块进行位移
|
|
@@ -129,7 +133,7 @@ export default {
|
|
|
129
133
|
// 通过translateX移动滑块,其移动的距离为索引*item的宽度
|
|
130
134
|
// #ifndef APP-NVUE
|
|
131
135
|
style.transform = `translateX(${
|
|
132
|
-
this.
|
|
136
|
+
this.innerCurrent * this.itemRect.width
|
|
133
137
|
}px)`;
|
|
134
138
|
// #endif
|
|
135
139
|
if (this.mode === "subsection") {
|
|
@@ -156,16 +160,16 @@ export default {
|
|
|
156
160
|
return (index) => {
|
|
157
161
|
const style = {};
|
|
158
162
|
style.fontWeight =
|
|
159
|
-
this.bold && this.
|
|
163
|
+
this.bold && this.innerCurrent === index ? "bold" : "normal";
|
|
160
164
|
style.fontSize = uni.$u.addUnit(this.fontSize);
|
|
161
165
|
// subsection模式下,激活时默认为白色的文字
|
|
162
166
|
if (this.mode === "subsection") {
|
|
163
167
|
style.color =
|
|
164
|
-
this.
|
|
168
|
+
this.innerCurrent === index ? "#fff" : this.inactiveColor;
|
|
165
169
|
} else {
|
|
166
170
|
// button模式下,激活时文字颜色默认为activeColor
|
|
167
171
|
style.color =
|
|
168
|
-
this.
|
|
172
|
+
this.innerCurrent === index
|
|
169
173
|
? this.activeColor
|
|
170
174
|
: this.inactiveColor;
|
|
171
175
|
}
|
|
@@ -179,6 +183,7 @@ export default {
|
|
|
179
183
|
emits: ["change"],
|
|
180
184
|
methods: {
|
|
181
185
|
init() {
|
|
186
|
+
this.innerCurrent = this.current
|
|
182
187
|
uni.$u.sleep().then(() => this.getRect());
|
|
183
188
|
},
|
|
184
189
|
// 判断展示文本
|
|
@@ -202,6 +207,7 @@ export default {
|
|
|
202
207
|
// #endif
|
|
203
208
|
},
|
|
204
209
|
clickHandler(index) {
|
|
210
|
+
this.innerCurrent = index
|
|
205
211
|
this.$emit("change", index);
|
|
206
212
|
},
|
|
207
213
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<view
|
|
3
3
|
class="u-swiper"
|
|
4
4
|
:style="{
|
|
5
|
-
backgroundColor: bgColor,
|
|
5
|
+
backgroundColor: bgColor,
|
|
6
6
|
height: $u.addUnit(height),
|
|
7
7
|
borderRadius: $u.addUnit(radius)
|
|
8
8
|
}"
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
>
|
|
14
14
|
<u-loading-icon mode="circle"></u-loading-icon>
|
|
15
15
|
</view>
|
|
16
|
-
<swiper
|
|
17
|
-
v-else
|
|
16
|
+
<swiper
|
|
18
17
|
class="u-swiper__wrapper"
|
|
19
|
-
:style="{
|
|
20
|
-
height: $u.addUnit(height)
|
|
18
|
+
:style="{
|
|
19
|
+
height: $u.addUnit(height)
|
|
21
20
|
}"
|
|
22
21
|
@change="change"
|
|
23
22
|
:circular="circular"
|
|
@@ -206,7 +205,7 @@
|
|
|
206
205
|
|
|
207
206
|
<style lang="scss" scoped>
|
|
208
207
|
@import "../../libs/css/components.scss";
|
|
209
|
-
|
|
208
|
+
|
|
210
209
|
.u-swiper {
|
|
211
210
|
@include flex;
|
|
212
211
|
justify-content: center;
|
|
@@ -214,8 +213,7 @@
|
|
|
214
213
|
position: relative;
|
|
215
214
|
overflow: hidden;
|
|
216
215
|
|
|
217
|
-
&__wrapper {
|
|
218
|
-
flex: 1;
|
|
216
|
+
&__wrapper {
|
|
219
217
|
|
|
220
218
|
&__item {
|
|
221
219
|
flex: 1;
|
|
@@ -1,226 +1,226 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view
|
|
3
|
-
class="u-text"
|
|
4
|
-
:class="[]"
|
|
5
|
-
v-if="show"
|
|
6
|
-
:style="{
|
|
7
|
-
margin: margin,
|
|
8
|
-
justifyContent: align === 'left' ? 'flex-start' : align === 'center' ? 'center' : 'flex-end'
|
|
9
|
-
}"
|
|
10
|
-
@tap="clickHandler"
|
|
11
|
-
>
|
|
12
|
-
<text
|
|
13
|
-
:class="['u-text__price', type && `u-text__value--${type}`]"
|
|
14
|
-
v-if="mode === 'price'"
|
|
15
|
-
:style="[valueStyle]"
|
|
16
|
-
>¥</text
|
|
17
|
-
>
|
|
18
|
-
<view class="u-text__prefix-icon" v-if="prefixIcon">
|
|
19
|
-
<u-icon
|
|
20
|
-
:name="prefixIcon"
|
|
21
|
-
:customStyle="$u.addStyle(iconStyle)"
|
|
22
|
-
></u-icon>
|
|
23
|
-
</view>
|
|
24
|
-
<u-link
|
|
25
|
-
v-if="mode === 'link'"
|
|
26
|
-
:style="{fontWeight: valueStyle.fontWeight, wordWrap: valueStyle.wordWrap, fontSize: valueStyle.fontSize}"
|
|
27
|
-
:href="href"
|
|
28
|
-
underLine
|
|
29
|
-
></u-link>
|
|
30
|
-
<template v-else-if="openType && isMp">
|
|
31
|
-
<button
|
|
32
|
-
class="u-reset-button u-text__value"
|
|
33
|
-
:style="[valueStyle]"
|
|
34
|
-
:data-index="index"
|
|
35
|
-
:openType="openType"
|
|
36
|
-
@getuserinfo="onGetUserInfo"
|
|
37
|
-
@contact="onContact"
|
|
38
|
-
@getphonenumber="onGetPhoneNumber"
|
|
39
|
-
@error="onError"
|
|
40
|
-
@launchapp="onLaunchApp"
|
|
41
|
-
@opensetting="onOpenSetting"
|
|
42
|
-
:lang="lang"
|
|
43
|
-
:session-from="sessionFrom"
|
|
44
|
-
:send-message-title="sendMessageTitle"
|
|
45
|
-
:send-message-path="sendMessagePath"
|
|
46
|
-
:send-message-img="sendMessageImg"
|
|
47
|
-
:show-message-card="showMessageCard"
|
|
48
|
-
:app-parameter="appParameter"
|
|
49
|
-
>
|
|
50
|
-
{{ value }}
|
|
51
|
-
</button>
|
|
52
|
-
</template>
|
|
53
|
-
<text
|
|
54
|
-
v-else
|
|
55
|
-
class="u-text__value"
|
|
56
|
-
:style="[valueStyle]"
|
|
57
|
-
:class="[
|
|
58
|
-
type && `u-text__value--${type}`,
|
|
59
|
-
lines && `u-line-${lines}`
|
|
60
|
-
]"
|
|
61
|
-
>{{ value }}</text
|
|
62
|
-
>
|
|
63
|
-
<view class="u-text__suffix-icon" v-if="suffixIcon">
|
|
64
|
-
<u-icon
|
|
65
|
-
:name="suffixIcon"
|
|
66
|
-
:customStyle="$u.addStyle(iconStyle)"
|
|
67
|
-
></u-icon>
|
|
68
|
-
</view>
|
|
69
|
-
</view>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<script>
|
|
73
|
-
import value from './value.js'
|
|
74
|
-
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
75
|
-
import mixin from '../../libs/mixin/mixin.js';
|
|
76
|
-
import button from '../../libs/mixin/button.js'
|
|
77
|
-
import openType from '../../libs/mixin/openType.js'
|
|
78
|
-
import props from './props.js'
|
|
79
|
-
/**
|
|
80
|
-
* Text 文本
|
|
81
|
-
* @description 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
|
|
82
|
-
* @tutorial https://ijry.github.io/uview-plus/components/loading.html
|
|
83
|
-
* @property {String} type 主题颜色
|
|
84
|
-
* @property {Boolean} show 是否显示(默认 true )
|
|
85
|
-
* @property {String | Number} text 显示的值
|
|
86
|
-
* @property {String} prefixIcon 前置图标
|
|
87
|
-
* @property {String} suffixIcon 后置图标
|
|
88
|
-
* @property {String} mode 文本处理的匹配模式 text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
|
|
89
|
-
* @property {String} href mode=link下,配置的链接
|
|
90
|
-
* @property {String | Function} format 格式化规则
|
|
91
|
-
* @property {Boolean} call mode=phone时,点击文本是否拨打电话(默认 false )
|
|
92
|
-
* @property {String} openType 小程序的打开方式
|
|
93
|
-
* @property {Boolean} bold 是否粗体,默认normal(默认 false )
|
|
94
|
-
* @property {Boolean} block 是否块状(默认 false )
|
|
95
|
-
* @property {String | Number} lines 文本显示的行数,如果设置,超出此行数,将会显示省略号
|
|
96
|
-
* @property {String} color 文本颜色(默认 '#303133' )
|
|
97
|
-
* @property {String | Number} size 字体大小(默认 15 )
|
|
98
|
-
* @property {Object | String} iconStyle 图标的样式 (默认 {fontSize: '15px'} )
|
|
99
|
-
* @property {String} decoration 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
|
|
100
|
-
* @property {Object | String | Number} margin 外边距,对象、字符串,数值形式均可(默认 0 )
|
|
101
|
-
* @property {String | Number} lineHeight 文本行高
|
|
102
|
-
* @property {String} align 文本对齐方式,可选值left|center|right(默认 'left' )
|
|
103
|
-
* @property {String} wordWrap 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
|
|
104
|
-
* @event {Function} click 点击触发事件
|
|
105
|
-
* @example <
|
|
106
|
-
*/
|
|
107
|
-
export default {
|
|
108
|
-
name: 'u--text',
|
|
109
|
-
// #ifdef MP
|
|
110
|
-
mixins: [mpMixin, mixin, value, button, openType, props],
|
|
111
|
-
// #endif
|
|
112
|
-
// #ifndef MP
|
|
113
|
-
mixins: [mpMixin, mixin, value, props],
|
|
114
|
-
// #endif
|
|
115
|
-
emits: ['click'],
|
|
116
|
-
computed: {
|
|
117
|
-
valueStyle() {
|
|
118
|
-
const style = {
|
|
119
|
-
textDecoration: this.decoration,
|
|
120
|
-
fontWeight: this.bold ? 'bold' : 'normal',
|
|
121
|
-
wordWrap: this.wordWrap,
|
|
122
|
-
fontSize: uni.$u.addUnit(this.size)
|
|
123
|
-
}
|
|
124
|
-
!this.type && (style.color = this.color)
|
|
125
|
-
this.isNvue && this.lines && (style.lines = this.lines)
|
|
126
|
-
this.lineHeight &&
|
|
127
|
-
(style.lineHeight = uni.$u.addUnit(this.lineHeight))
|
|
128
|
-
!this.isNvue && this.block && (style.display = 'block')
|
|
129
|
-
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
|
|
130
|
-
},
|
|
131
|
-
isNvue() {
|
|
132
|
-
let nvue = false
|
|
133
|
-
// #ifdef APP-NVUE
|
|
134
|
-
nvue = true
|
|
135
|
-
// #endif
|
|
136
|
-
return nvue
|
|
137
|
-
},
|
|
138
|
-
isMp() {
|
|
139
|
-
let mp = false
|
|
140
|
-
// #ifdef MP
|
|
141
|
-
mp = true
|
|
142
|
-
// #endif
|
|
143
|
-
return mp
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
data() {
|
|
147
|
-
return {}
|
|
148
|
-
},
|
|
149
|
-
methods: {
|
|
150
|
-
clickHandler() {
|
|
151
|
-
// 如果为手机号模式,拨打电话
|
|
152
|
-
if (this.call && this.mode === 'phone') {
|
|
153
|
-
uni.makePhoneCall({
|
|
154
|
-
phoneNumber: this.text
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
this.$emit('click')
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
</script>
|
|
162
|
-
|
|
163
|
-
<style lang="scss" scoped>
|
|
164
|
-
@import '../../libs/css/components.scss';
|
|
165
|
-
|
|
166
|
-
.u-text {
|
|
167
|
-
@include flex(row);
|
|
168
|
-
align-items: center;
|
|
169
|
-
flex-wrap: nowrap;
|
|
170
|
-
flex: 1;
|
|
171
|
-
/* #ifndef APP-NVUE */
|
|
172
|
-
width: 100%;
|
|
173
|
-
/* #endif */
|
|
174
|
-
|
|
175
|
-
&__price {
|
|
176
|
-
font-size: 14px;
|
|
177
|
-
color: $u-content-color;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&__value {
|
|
181
|
-
font-size: 14px;
|
|
182
|
-
@include flex;
|
|
183
|
-
color: $u-content-color;
|
|
184
|
-
flex-wrap: wrap;
|
|
185
|
-
// flex: 1;
|
|
186
|
-
text-overflow: ellipsis;
|
|
187
|
-
align-items: center;
|
|
188
|
-
|
|
189
|
-
&--primary {
|
|
190
|
-
color: $u-primary;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
&--warning {
|
|
194
|
-
color: $u-warning;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
&--success {
|
|
198
|
-
color: $u-success;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
&--info {
|
|
202
|
-
color: $u-info;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
&--error {
|
|
206
|
-
color: $u-error;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
&--main {
|
|
210
|
-
color: $u-main-color;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
&--content {
|
|
214
|
-
color: $u-content-color;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
&--tips {
|
|
218
|
-
color: $u-tips-color;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
&--light {
|
|
222
|
-
color: $u-light-color;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-text"
|
|
4
|
+
:class="[]"
|
|
5
|
+
v-if="show"
|
|
6
|
+
:style="{
|
|
7
|
+
margin: margin,
|
|
8
|
+
justifyContent: align === 'left' ? 'flex-start' : align === 'center' ? 'center' : 'flex-end'
|
|
9
|
+
}"
|
|
10
|
+
@tap="clickHandler"
|
|
11
|
+
>
|
|
12
|
+
<text
|
|
13
|
+
:class="['u-text__price', type && `u-text__value--${type}`]"
|
|
14
|
+
v-if="mode === 'price'"
|
|
15
|
+
:style="[valueStyle]"
|
|
16
|
+
>¥</text
|
|
17
|
+
>
|
|
18
|
+
<view class="u-text__prefix-icon" v-if="prefixIcon">
|
|
19
|
+
<u-icon
|
|
20
|
+
:name="prefixIcon"
|
|
21
|
+
:customStyle="$u.addStyle(iconStyle)"
|
|
22
|
+
></u-icon>
|
|
23
|
+
</view>
|
|
24
|
+
<u-link
|
|
25
|
+
v-if="mode === 'link'" class="u-text__value"
|
|
26
|
+
:style="{fontWeight: valueStyle.fontWeight, wordWrap: valueStyle.wordWrap, fontSize: valueStyle.fontSize}" :class="[ type && `u-text__value--${type}`, lines && `u-line-${lines}` ]" :text="value"
|
|
27
|
+
:href="href"
|
|
28
|
+
underLine
|
|
29
|
+
></u-link>
|
|
30
|
+
<template v-else-if="openType && isMp">
|
|
31
|
+
<button
|
|
32
|
+
class="u-reset-button u-text__value"
|
|
33
|
+
:style="[valueStyle]"
|
|
34
|
+
:data-index="index"
|
|
35
|
+
:openType="openType"
|
|
36
|
+
@getuserinfo="onGetUserInfo"
|
|
37
|
+
@contact="onContact"
|
|
38
|
+
@getphonenumber="onGetPhoneNumber"
|
|
39
|
+
@error="onError"
|
|
40
|
+
@launchapp="onLaunchApp"
|
|
41
|
+
@opensetting="onOpenSetting"
|
|
42
|
+
:lang="lang"
|
|
43
|
+
:session-from="sessionFrom"
|
|
44
|
+
:send-message-title="sendMessageTitle"
|
|
45
|
+
:send-message-path="sendMessagePath"
|
|
46
|
+
:send-message-img="sendMessageImg"
|
|
47
|
+
:show-message-card="showMessageCard"
|
|
48
|
+
:app-parameter="appParameter"
|
|
49
|
+
>
|
|
50
|
+
{{ value }}
|
|
51
|
+
</button>
|
|
52
|
+
</template>
|
|
53
|
+
<text
|
|
54
|
+
v-else
|
|
55
|
+
class="u-text__value"
|
|
56
|
+
:style="[valueStyle]"
|
|
57
|
+
:class="[
|
|
58
|
+
type && `u-text__value--${type}`,
|
|
59
|
+
lines && `u-line-${lines}`
|
|
60
|
+
]"
|
|
61
|
+
>{{ value }}</text
|
|
62
|
+
>
|
|
63
|
+
<view class="u-text__suffix-icon" v-if="suffixIcon">
|
|
64
|
+
<u-icon
|
|
65
|
+
:name="suffixIcon"
|
|
66
|
+
:customStyle="$u.addStyle(iconStyle)"
|
|
67
|
+
></u-icon>
|
|
68
|
+
</view>
|
|
69
|
+
</view>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script>
|
|
73
|
+
import value from './value.js'
|
|
74
|
+
import mpMixin from '../../libs/mixin/mpMixin.js';
|
|
75
|
+
import mixin from '../../libs/mixin/mixin.js';
|
|
76
|
+
import button from '../../libs/mixin/button.js'
|
|
77
|
+
import openType from '../../libs/mixin/openType.js'
|
|
78
|
+
import props from './props.js'
|
|
79
|
+
/**
|
|
80
|
+
* Text 文本
|
|
81
|
+
* @description 此组件集成了文本类在项目中的常用功能,包括状态,拨打电话,格式化日期,*替换,超链接...等功能。 您大可不必在使用特殊文本时自己定义,text组件几乎涵盖您能使用的大部分场景。
|
|
82
|
+
* @tutorial https://ijry.github.io/uview-plus/components/loading.html
|
|
83
|
+
* @property {String} type 主题颜色
|
|
84
|
+
* @property {Boolean} show 是否显示(默认 true )
|
|
85
|
+
* @property {String | Number} text 显示的值
|
|
86
|
+
* @property {String} prefixIcon 前置图标
|
|
87
|
+
* @property {String} suffixIcon 后置图标
|
|
88
|
+
* @property {String} mode 文本处理的匹配模式 text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
|
|
89
|
+
* @property {String} href mode=link下,配置的链接
|
|
90
|
+
* @property {String | Function} format 格式化规则
|
|
91
|
+
* @property {Boolean} call mode=phone时,点击文本是否拨打电话(默认 false )
|
|
92
|
+
* @property {String} openType 小程序的打开方式
|
|
93
|
+
* @property {Boolean} bold 是否粗体,默认normal(默认 false )
|
|
94
|
+
* @property {Boolean} block 是否块状(默认 false )
|
|
95
|
+
* @property {String | Number} lines 文本显示的行数,如果设置,超出此行数,将会显示省略号
|
|
96
|
+
* @property {String} color 文本颜色(默认 '#303133' )
|
|
97
|
+
* @property {String | Number} size 字体大小(默认 15 )
|
|
98
|
+
* @property {Object | String} iconStyle 图标的样式 (默认 {fontSize: '15px'} )
|
|
99
|
+
* @property {String} decoration 文字装饰,下划线,中划线等,可选值 none|underline|line-through(默认 'none' )
|
|
100
|
+
* @property {Object | String | Number} margin 外边距,对象、字符串,数值形式均可(默认 0 )
|
|
101
|
+
* @property {String | Number} lineHeight 文本行高
|
|
102
|
+
* @property {String} align 文本对齐方式,可选值left|center|right(默认 'left' )
|
|
103
|
+
* @property {String} wordWrap 文字换行,可选值break-word|normal|anywhere(默认 'normal' )
|
|
104
|
+
* @event {Function} click 点击触发事件
|
|
105
|
+
* @example <up-text text="我用十年青春,赴你最后之约"></up-text>
|
|
106
|
+
*/
|
|
107
|
+
export default {
|
|
108
|
+
name: 'u--text',
|
|
109
|
+
// #ifdef MP
|
|
110
|
+
mixins: [mpMixin, mixin, value, button, openType, props],
|
|
111
|
+
// #endif
|
|
112
|
+
// #ifndef MP
|
|
113
|
+
mixins: [mpMixin, mixin, value, props],
|
|
114
|
+
// #endif
|
|
115
|
+
emits: ['click'],
|
|
116
|
+
computed: {
|
|
117
|
+
valueStyle() {
|
|
118
|
+
const style = {
|
|
119
|
+
textDecoration: this.decoration,
|
|
120
|
+
fontWeight: this.bold ? 'bold' : 'normal',
|
|
121
|
+
wordWrap: this.wordWrap,
|
|
122
|
+
fontSize: uni.$u.addUnit(this.size)
|
|
123
|
+
}
|
|
124
|
+
!this.type && (style.color = this.color)
|
|
125
|
+
this.isNvue && this.lines && (style.lines = this.lines)
|
|
126
|
+
this.lineHeight &&
|
|
127
|
+
(style.lineHeight = uni.$u.addUnit(this.lineHeight))
|
|
128
|
+
!this.isNvue && this.block && (style.display = 'block')
|
|
129
|
+
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
|
|
130
|
+
},
|
|
131
|
+
isNvue() {
|
|
132
|
+
let nvue = false
|
|
133
|
+
// #ifdef APP-NVUE
|
|
134
|
+
nvue = true
|
|
135
|
+
// #endif
|
|
136
|
+
return nvue
|
|
137
|
+
},
|
|
138
|
+
isMp() {
|
|
139
|
+
let mp = false
|
|
140
|
+
// #ifdef MP
|
|
141
|
+
mp = true
|
|
142
|
+
// #endif
|
|
143
|
+
return mp
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
data() {
|
|
147
|
+
return {}
|
|
148
|
+
},
|
|
149
|
+
methods: {
|
|
150
|
+
clickHandler() {
|
|
151
|
+
// 如果为手机号模式,拨打电话
|
|
152
|
+
if (this.call && this.mode === 'phone') {
|
|
153
|
+
uni.makePhoneCall({
|
|
154
|
+
phoneNumber: this.text
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
this.$emit('click')
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<style lang="scss" scoped>
|
|
164
|
+
@import '../../libs/css/components.scss';
|
|
165
|
+
|
|
166
|
+
.u-text {
|
|
167
|
+
@include flex(row);
|
|
168
|
+
align-items: center;
|
|
169
|
+
flex-wrap: nowrap;
|
|
170
|
+
flex: 1;
|
|
171
|
+
/* #ifndef APP-NVUE */
|
|
172
|
+
width: 100%;
|
|
173
|
+
/* #endif */
|
|
174
|
+
|
|
175
|
+
&__price {
|
|
176
|
+
font-size: 14px;
|
|
177
|
+
color: $u-content-color;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&__value {
|
|
181
|
+
font-size: 14px;
|
|
182
|
+
@include flex;
|
|
183
|
+
color: $u-content-color;
|
|
184
|
+
flex-wrap: wrap;
|
|
185
|
+
// flex: 1;
|
|
186
|
+
text-overflow: ellipsis;
|
|
187
|
+
align-items: center;
|
|
188
|
+
|
|
189
|
+
&--primary {
|
|
190
|
+
color: $u-primary;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
&--warning {
|
|
194
|
+
color: $u-warning;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&--success {
|
|
198
|
+
color: $u-success;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
&--info {
|
|
202
|
+
color: $u-info;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&--error {
|
|
206
|
+
color: $u-error;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&--main {
|
|
210
|
+
color: $u-main-color;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&--content {
|
|
214
|
+
color: $u-content-color;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&--tips {
|
|
218
|
+
color: $u-tips-color;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
&--light {
|
|
222
|
+
color: $u-light-color;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
</style>
|