uview-plus 3.1.52 → 3.2.5
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 +51 -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 +29 -17
- 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-number-box/u-number-box.vue +4 -4
- package/components/u-picker/u-picker.vue +5 -2
- package/components/u-popup/u-popup.vue +1 -1
- package/components/u-radio/u-radio.vue +2 -2
- package/components/u-rate/u-rate.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 +35 -21
- package/components/u-swiper/u-swiper.vue +6 -8
- package/components/u-switch/u-switch.vue +1 -1
- package/components/u-tabbar-item/u-tabbar-item.vue +1 -1
- package/components/u-tabs/u-tabs.vue +1 -0
- package/components/u-tag/props.js +5 -2
- package/components/u-tag/u-tag.vue +1 -1
- 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/index.js +5 -2
- package/libs/config/props/formItem.js +1 -0
- package/libs/config/props/tag.js +30 -29
- package/libs/css/common.scss +4 -1
- package/libs/css/components.scss +5 -5
- package/libs/css/flex.scss +45 -45
- package/libs/mixin/mixin.js +2 -2
- package/libs/mixin/mpShare.js +15 -13
- package/package.json +1 -1
- package/types/comps/_common.d.ts +9 -0
- package/types/comps/actionSheet.d.ts +121 -0
- package/types/comps/album.d.ts +72 -0
- package/types/comps/alert.d.ts +55 -0
- package/types/comps/avatar.d.ts +85 -0
- package/types/comps/avatarGroup.d.ts +62 -0
- package/types/comps/backTop.d.ts +74 -0
- package/types/comps/badge.d.ts +76 -0
- package/types/comps/button.d.ts +169 -0
- package/types/comps/calendar.d.ts +164 -0
- package/types/comps/cell.d.ts +133 -0
- package/types/comps/cellGroup.d.ts +27 -0
- package/types/comps/checkbox.d.ts +69 -0
- package/types/comps/checkboxGroup.d.ts +93 -0
- package/types/comps/code.d.ts +69 -0
- package/types/comps/codeInput.d.ts +98 -0
- package/types/comps/col.d.ts +43 -0
- package/types/comps/collapse.d.ts +52 -0
- package/types/comps/collapseItem.d.ts +83 -0
- package/types/comps/countDown.d.ts +60 -0
- package/types/comps/countTo.d.ts +88 -0
- package/types/comps/datetimePicker.d.ts +146 -0
- package/types/comps/divider.d.ts +58 -0
- package/types/comps/empty.d.ts +72 -0
- package/types/comps/form.d.ts +76 -0
- package/types/comps/formItem.d.ts +68 -0
- package/types/comps/gap.d.ts +35 -0
- package/types/comps/grid.d.ts +34 -0
- package/types/comps/gridItem.d.ts +28 -0
- package/types/comps/icon.d.ts +93 -0
- package/types/comps/image.d.ts +119 -0
- package/types/comps/indexAnchor.d.ts +38 -0
- package/types/comps/indexItem.d.ts +18 -0
- package/types/comps/indexList.d.ts +39 -0
- package/types/comps/input.d.ts +234 -0
- package/types/comps/keyboard.d.ts +125 -0
- package/types/comps/line.d.ts +44 -0
- package/types/comps/lineProgress.d.ts +51 -0
- package/types/comps/link.d.ts +51 -0
- package/types/comps/list.d.ts +92 -0
- package/types/comps/listItem.d.ts +18 -0
- package/types/comps/loadMore.d.ts +108 -0
- package/types/comps/loadingIcon.d.ts +68 -0
- package/types/comps/loadingPage.d.ts +58 -0
- package/types/comps/modal.d.ts +115 -0
- package/types/comps/navbar.d.ts +113 -0
- package/types/comps/noNetwork.d.ts +40 -0
- package/types/comps/noticeBar.d.ts +85 -0
- package/types/comps/notify.d.ts +73 -0
- package/types/comps/numberBox.d.ts +155 -0
- package/types/comps/overlay.d.ts +46 -0
- package/types/comps/parse.d.ts +101 -0
- package/types/comps/picker.d.ts +115 -0
- package/types/comps/popup.d.ts +103 -0
- package/types/comps/radio.d.ts +77 -0
- package/types/comps/radioGroup.d.ts +97 -0
- package/types/comps/rate.d.ts +85 -0
- package/types/comps/readMore.d.ts +80 -0
- package/types/comps/row.d.ts +34 -0
- package/types/comps/scrollList.d.ts +51 -0
- package/types/comps/search.d.ts +167 -0
- package/types/comps/skeleton.d.ts +70 -0
- package/types/comps/slider.d.ts +79 -0
- package/types/comps/steps.d.ts +48 -0
- package/types/comps/stepsItem.d.ts +41 -0
- package/types/comps/sticky.d.ts +48 -0
- package/types/comps/subsection.d.ts +64 -0
- package/types/comps/swipeAction.d.ts +24 -0
- package/types/comps/swipeActionItem.d.ts +58 -0
- package/types/comps/swiper.d.ts +142 -0
- package/types/comps/swiperIndicator.d.ts +37 -0
- package/types/comps/switch.d.ts +73 -0
- package/types/comps/tabbar.d.ts +54 -0
- package/types/comps/tabbarItem.d.ts +52 -0
- package/types/comps/tabs.d.ts +85 -0
- package/types/comps/tag.d.ts +93 -0
- package/types/comps/text.d.ts +110 -0
- package/types/comps/textarea.d.ts +158 -0
- package/types/comps/toast.d.ts +59 -0
- package/types/comps/tooltip.d.ts +71 -0
- package/types/comps/transition.d.ts +61 -0
- package/types/comps/upload.d.ts +163 -0
- package/types/comps.d.ts +99 -0
- package/types/index.d.ts +47 -0
|
@@ -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>
|