im-ui-mobile 0.1.0 → 0.1.1
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/components/im-avatar/im-avatar.vue +7 -7
- package/components/im-badge/im-badge.vue +326 -0
- package/components/im-button/im-button.vue +71 -34
- package/components/im-card/im-card.vue +563 -0
- package/components/im-chat-item/im-chat-item.vue +5 -4
- package/components/im-col/im-col.vue +191 -0
- package/components/im-dialog/im-dialog.vue +543 -0
- package/components/im-double-tap-view/im-double-tap-view.vue +93 -0
- package/components/im-emoji-picker/im-emoji-picker.vue +1143 -0
- package/components/im-friend-item/im-friend-item.vue +1 -1
- package/components/im-group-item/im-group-item.vue +1 -1
- package/components/im-group-member-selector/im-group-member-selector.vue +5 -5
- package/components/im-group-rtc-join/im-group-rtc-join.vue +8 -8
- package/components/im-icon/im-icon.vue +593 -0
- package/components/im-image-upload/im-image-upload.vue +0 -2
- package/components/im-link/im-link.vue +628 -0
- package/components/im-loading/im-loading.vue +13 -4
- package/components/im-mention-picker/im-mention-picker.vue +8 -7
- package/components/im-message-action/im-message-action.vue +678 -0
- package/components/im-message-item/im-message-item.vue +28 -26
- package/components/im-message-list/im-message-list.vue +1108 -0
- package/components/im-modal/im-modal.vue +373 -0
- package/components/im-nav-bar/im-nav-bar.vue +689 -75
- package/components/im-parse/im-parse.vue +1054 -0
- package/components/im-popup/im-popup.vue +467 -0
- package/components/im-read-receipt/im-read-receipt.vue +9 -9
- package/components/im-row/im-row.vue +189 -0
- package/components/im-search/im-search.vue +762 -0
- package/components/im-sku/im-sku.vue +720 -0
- package/components/im-sku/utils/helper.ts +182 -0
- package/components/im-stepper/im-stepper.vue +585 -0
- package/components/im-stepper/utils/helper.ts +167 -0
- package/components/im-upload/im-upload.vue +1236 -0
- package/components/im-voice-input/im-voice-input.vue +1 -1
- package/index.js +3 -1
- package/index.scss +19 -0
- package/libs/emoji-data.ts +229 -0
- package/libs/index.ts +16 -16
- package/package.json +1 -2
- package/styles/button.scss +33 -33
- package/theme.scss +2 -2
- package/types/components/badge.d.ts +42 -0
- package/types/components/button.d.ts +2 -1
- package/types/components/card.d.ts +122 -0
- package/types/components/col.d.ts +37 -0
- package/types/components/dialog.d.ts +125 -0
- package/types/components/double-tap-view.d.ts +31 -0
- package/types/components/emoji-picker.d.ts +121 -0
- package/types/components/group-rtc-join.d.ts +1 -1
- package/types/components/icon.d.ts +77 -0
- package/types/components/link.d.ts +55 -0
- package/types/components/loading.d.ts +1 -0
- package/types/components/message-action.d.ts +96 -0
- package/types/components/message-item.d.ts +2 -2
- package/types/components/message-list.d.ts +136 -0
- package/types/components/modal.d.ts +106 -0
- package/types/components/nav-bar.d.ts +125 -0
- package/types/components/parse.d.ts +90 -0
- package/types/components/popup.d.ts +58 -0
- package/types/components/row.d.ts +31 -0
- package/types/components/search.d.ts +54 -0
- package/types/components/sku.d.ts +195 -0
- package/types/components/stepper.d.ts +97 -0
- package/types/components/upload.d.ts +137 -0
- package/types/components.d.ts +17 -1
- package/types/index.d.ts +38 -1
- package/types/libs/index.d.ts +10 -10
- package/types/utils/base64.d.ts +5 -0
- package/types/utils/dom.d.ts +3 -0
- package/types/utils/enums.d.ts +4 -5
- package/types/utils/validator.d.ts +74 -0
- package/utils/base64.js +18 -0
- package/utils/dom.js +353 -1
- package/utils/enums.js +4 -5
- package/utils/validator.js +230 -0
- package/components/im-file-upload/im-file-upload.vue +0 -309
- package/types/components/arrow-bar.d.ts +0 -14
- package/types/components/file-upload.d.ts +0 -58
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="avatar none-pointer-events" @click="showUserInfo" :title="
|
|
2
|
+
<view class="avatar none-pointer-events" @click="showUserInfo" :title="title">
|
|
3
3
|
<image v-if="url" class="avatar-image" :src="url" :style="avatarImageStyle" lazy-load="true"
|
|
4
4
|
mode="aspectFill" />
|
|
5
5
|
<view v-else class="avatar-text" :style="avatarTextStyle">
|
|
6
|
-
{{
|
|
6
|
+
{{ title?.substring(0, 1).toUpperCase() }}
|
|
7
7
|
</view>
|
|
8
8
|
<view v-if="online" class="online" title="用户当前在线" />
|
|
9
9
|
</view>
|
|
@@ -16,14 +16,14 @@ interface Props {
|
|
|
16
16
|
id?: number;
|
|
17
17
|
size?: number | string;
|
|
18
18
|
url?: string;
|
|
19
|
-
|
|
19
|
+
title?: string;
|
|
20
20
|
radius?: string;
|
|
21
21
|
online?: boolean;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const props = withDefaults(defineProps<Props>(), {
|
|
25
25
|
size: 'default',
|
|
26
|
-
|
|
26
|
+
title: '',
|
|
27
27
|
radius: "50%",
|
|
28
28
|
online: false
|
|
29
29
|
});
|
|
@@ -77,12 +77,12 @@ const avatarTextStyle = computed(() => {
|
|
|
77
77
|
});
|
|
78
78
|
|
|
79
79
|
const textColor = computed(() => {
|
|
80
|
-
if (!props.
|
|
80
|
+
if (!props.title) {
|
|
81
81
|
return '#fff';
|
|
82
82
|
}
|
|
83
83
|
let hash = 0;
|
|
84
|
-
for (let i = 0; i < props.
|
|
85
|
-
hash += props.
|
|
84
|
+
for (let i = 0; i < props.title.length; i++) {
|
|
85
|
+
hash += props.title.charCodeAt(i);
|
|
86
86
|
}
|
|
87
87
|
return colors[hash % colors.length];
|
|
88
88
|
});
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="im-badge" :class="[
|
|
3
|
+
typeClass,
|
|
4
|
+
sizeClass,
|
|
5
|
+
shapeClass,
|
|
6
|
+
showBadge ? '' : 'im-badge--hidden',
|
|
7
|
+
dot ? 'im-badge--dot' : '',
|
|
8
|
+
!childrenSlot && !isAbsolute ? 'im-badge--standalone' : '',
|
|
9
|
+
isAbsolute ? 'im-badge--absolute' : ''
|
|
10
|
+
]" :style="{
|
|
11
|
+
'--badge-bg-color': bgColor || undefined,
|
|
12
|
+
'--badge-text-color': textColor || undefined,
|
|
13
|
+
'--badge-offset-x': offset[0] + 'px',
|
|
14
|
+
'--badge-offset-y': offset[1] + 'px'
|
|
15
|
+
}" @click="handleClick">
|
|
16
|
+
<!-- 包裹内容区域 -->
|
|
17
|
+
<view v-if="childrenSlot" class="im-badge__wrapper">
|
|
18
|
+
<slot />
|
|
19
|
+
<view v-if="showBadge" class="im-badge__content">
|
|
20
|
+
<template v-if="!dot">
|
|
21
|
+
<text class="im-badge__text">{{ displayValue }}</text>
|
|
22
|
+
</template>
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
|
|
26
|
+
<!-- 独立显示时 -->
|
|
27
|
+
<template v-else>
|
|
28
|
+
<view v-if="showBadge" class="im-badge__content im-badge__content--standalone">
|
|
29
|
+
<template v-if="!dot">
|
|
30
|
+
<text class="im-badge__text">{{ displayValue }}</text>
|
|
31
|
+
</template>
|
|
32
|
+
</view>
|
|
33
|
+
</template>
|
|
34
|
+
</view>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { computed, useSlots } from 'vue'
|
|
39
|
+
|
|
40
|
+
// 定义Props
|
|
41
|
+
interface BadgeProps {
|
|
42
|
+
/** 徽标显示的值 */
|
|
43
|
+
value?: string | number
|
|
44
|
+
/** 最大值,超过会显示 {max}+,为0时不做限制 */
|
|
45
|
+
max?: number
|
|
46
|
+
/** 是否显示为小圆点 */
|
|
47
|
+
dot?: boolean
|
|
48
|
+
/** 是否隐藏徽标 */
|
|
49
|
+
hidden?: boolean
|
|
50
|
+
/** 徽标类型 */
|
|
51
|
+
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
|
52
|
+
/** 自定义背景色 */
|
|
53
|
+
bgColor?: string
|
|
54
|
+
/** 自定义文字颜色 */
|
|
55
|
+
textColor?: string
|
|
56
|
+
/** 徽标尺寸 */
|
|
57
|
+
size?: 'small' | 'medium' | 'large'
|
|
58
|
+
/** 徽标形状 */
|
|
59
|
+
shape?: 'circle' | 'square' | 'rounded'
|
|
60
|
+
/** 是否绝对定位(需要子元素时生效) */
|
|
61
|
+
absolute?: boolean
|
|
62
|
+
/** 绝对定位的偏移量 [x, y] */
|
|
63
|
+
offset?: [number, number]
|
|
64
|
+
/** 当value为0时是否显示徽标 */
|
|
65
|
+
showZero?: boolean
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const props = withDefaults(defineProps<BadgeProps>(), {
|
|
69
|
+
value: '',
|
|
70
|
+
max: 99,
|
|
71
|
+
dot: false,
|
|
72
|
+
hidden: false,
|
|
73
|
+
type: 'danger',
|
|
74
|
+
size: 'medium',
|
|
75
|
+
shape: 'circle',
|
|
76
|
+
absolute: true,
|
|
77
|
+
offset: () => [0, 0],
|
|
78
|
+
showZero: false
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// 定义Emits
|
|
82
|
+
const emit = defineEmits<{
|
|
83
|
+
click: [event: MouseEvent]
|
|
84
|
+
}>()
|
|
85
|
+
|
|
86
|
+
// 使用Slots
|
|
87
|
+
const slots = useSlots()
|
|
88
|
+
const childrenSlot = computed(() => !!slots.default)
|
|
89
|
+
|
|
90
|
+
// 计算属性
|
|
91
|
+
const displayValue = computed(() => {
|
|
92
|
+
const { value, max, showZero } = props
|
|
93
|
+
|
|
94
|
+
if (props.dot) return ''
|
|
95
|
+
|
|
96
|
+
// 处理数字
|
|
97
|
+
if (typeof value === 'number') {
|
|
98
|
+
if (value === 0 && !showZero) return ''
|
|
99
|
+
if (max > 0 && value > max) return `${max}+`
|
|
100
|
+
return String(value)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// 处理字符串
|
|
104
|
+
if (typeof value === 'string') {
|
|
105
|
+
return value.length > 3 ? `${value.slice(0, 3)}...` : value
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return ''
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const showBadge = computed(() => {
|
|
112
|
+
if (props.hidden) return false
|
|
113
|
+
if (props.dot) return true
|
|
114
|
+
if (props.value === 0 && !props.showZero) return false
|
|
115
|
+
return !!(props.value || props.value === 0)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// CSS类名
|
|
119
|
+
const typeClass = computed(() => `im-badge--${props.type}`)
|
|
120
|
+
const sizeClass = computed(() => `im-badge--${props.size}`)
|
|
121
|
+
const shapeClass = computed(() => `im-badge--${props.shape}`)
|
|
122
|
+
const isAbsolute = computed(() => props.absolute && childrenSlot.value)
|
|
123
|
+
|
|
124
|
+
// 事件处理
|
|
125
|
+
const handleClick = (event: MouseEvent) => {
|
|
126
|
+
emit('click', event)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 暴露给ref的方法
|
|
130
|
+
defineExpose({
|
|
131
|
+
getValue: () => props.value
|
|
132
|
+
})
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<style lang="scss" scoped>
|
|
136
|
+
.im-badge {
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
position: relative;
|
|
139
|
+
box-sizing: border-box;
|
|
140
|
+
|
|
141
|
+
&--hidden {
|
|
142
|
+
display: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&--standalone {
|
|
146
|
+
position: relative;
|
|
147
|
+
// transform: none;
|
|
148
|
+
// top: auto;
|
|
149
|
+
// right: auto;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&--absolute {
|
|
153
|
+
position: relative;
|
|
154
|
+
display: inline-block;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&__wrapper {
|
|
158
|
+
position: relative;
|
|
159
|
+
display: inline-block;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&__content {
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: calc(-1 * var(--badge-offset-y, 0px));
|
|
165
|
+
right: calc(-1 * var(--badge-offset-x, 0px));
|
|
166
|
+
transform: translate(50%, -50%);
|
|
167
|
+
z-index: 10;
|
|
168
|
+
box-sizing: border-box;
|
|
169
|
+
|
|
170
|
+
// 确保徽标在内容之上
|
|
171
|
+
pointer-events: auto;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&__text {
|
|
175
|
+
display: block;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
font-weight: 500;
|
|
178
|
+
line-height: 1;
|
|
179
|
+
color: var(--badge-text-color, #ffffff);
|
|
180
|
+
text-align: center;
|
|
181
|
+
white-space: nowrap;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 类型样式
|
|
185
|
+
&--primary {
|
|
186
|
+
--badge-bg-color: #409eff;
|
|
187
|
+
--badge-text-color: #ffffff;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&--success {
|
|
191
|
+
--badge-bg-color: #67c23a;
|
|
192
|
+
--badge-text-color: #ffffff;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&--warning {
|
|
196
|
+
--badge-bg-color: #e6a23c;
|
|
197
|
+
--badge-text-color: #ffffff;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&--danger {
|
|
201
|
+
--badge-bg-color: #f56c6c;
|
|
202
|
+
--badge-text-color: #ffffff;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&--info {
|
|
206
|
+
--badge-bg-color: #909399;
|
|
207
|
+
--badge-text-color: #ffffff;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// 尺寸样式
|
|
211
|
+
&--small {
|
|
212
|
+
.im-badge__content {
|
|
213
|
+
min-width: 20rpx;
|
|
214
|
+
height: 20rpx;
|
|
215
|
+
padding: 0 6rpx;
|
|
216
|
+
|
|
217
|
+
.im-badge__text {
|
|
218
|
+
font-size: 16rpx;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&.im-badge--dot .im-badge__content {
|
|
223
|
+
width: 13rpx;
|
|
224
|
+
height: 13rpx;
|
|
225
|
+
min-width: 13rpx;
|
|
226
|
+
padding: 0;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&--medium {
|
|
231
|
+
.im-badge__content {
|
|
232
|
+
min-width: 30rpx;
|
|
233
|
+
height: 30rpx;
|
|
234
|
+
padding: 0 10rpx;
|
|
235
|
+
|
|
236
|
+
.im-badge__text {
|
|
237
|
+
font-size: 20rpx;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&.im-badge--dot .im-badge__content {
|
|
242
|
+
width: 18rpx;
|
|
243
|
+
height: 18rpx;
|
|
244
|
+
min-width: 18rpx;
|
|
245
|
+
padding: 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
&--large {
|
|
250
|
+
.im-badge__content {
|
|
251
|
+
min-width: 38rpx;
|
|
252
|
+
height: 38rpx;
|
|
253
|
+
padding: 0 12rpx;
|
|
254
|
+
|
|
255
|
+
.im-badge__text {
|
|
256
|
+
font-size: 28rpx;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&.im-badge--dot .im-badge__content {
|
|
261
|
+
width: 22rpx;
|
|
262
|
+
height: 22rpx;
|
|
263
|
+
min-width: 22rpx;
|
|
264
|
+
padding: 0;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// 形状样式
|
|
269
|
+
&--circle {
|
|
270
|
+
.im-badge__content {
|
|
271
|
+
border-radius: 100px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
&.im-badge--dot .im-badge__content {
|
|
275
|
+
border-radius: 50%;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&--rounded {
|
|
280
|
+
.im-badge__content {
|
|
281
|
+
border-radius: 4px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
&.im-badge--dot .im-badge__content {
|
|
285
|
+
border-radius: 50%;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&--square {
|
|
290
|
+
.im-badge__content {
|
|
291
|
+
border-radius: 0;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&.im-badge--dot .im-badge__content {
|
|
295
|
+
border-radius: 0;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// 徽标内容样式
|
|
300
|
+
.im-badge__content {
|
|
301
|
+
display: inline-flex;
|
|
302
|
+
align-items: center;
|
|
303
|
+
justify-content: center;
|
|
304
|
+
background-color: var(--badge-bg-color);
|
|
305
|
+
color: var(--badge-text-color);
|
|
306
|
+
|
|
307
|
+
// 添加阴影增强视觉效果
|
|
308
|
+
box-shadow: 0 0 0 1px #fff;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// 独立显示的徽标
|
|
312
|
+
&.im-badge--standalone {
|
|
313
|
+
|
|
314
|
+
.im-badge__content {
|
|
315
|
+
display: inline-flex;
|
|
316
|
+
align-items: center;
|
|
317
|
+
justify-content: center;
|
|
318
|
+
background-color: var(--badge-bg-color);
|
|
319
|
+
color: var(--badge-text-color);
|
|
320
|
+
|
|
321
|
+
// 添加阴影增强视觉效果
|
|
322
|
+
box-shadow: 0 0 0 1px #fff;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button class="im-button" :class="[
|
|
3
3
|
`im-button--${type}`,
|
|
4
|
-
`im-button--${size}`,
|
|
5
|
-
`im-button--${shape}`,
|
|
4
|
+
`im-button--${size} `,
|
|
5
|
+
`im-button--${size}--${shape}`,
|
|
6
6
|
{
|
|
7
7
|
'im-button--disabled': disabled,
|
|
8
8
|
'im-button--loading': loading,
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
@chooseavatar="onChooseAvatar">
|
|
21
21
|
<!-- 加载状态 -->
|
|
22
22
|
<view v-if="loading && showLoading" class="im-button__loading">
|
|
23
|
-
<view class="im-button__loading-spinner" :style="loadingStyle">
|
|
23
|
+
<!-- <view class="im-button__loading-spinner" :style="loadingStyle">
|
|
24
24
|
<view v-for="n in loadingDotCount" :key="n" class="im-button__loading-dot" :style="{
|
|
25
25
|
animationDelay: `${(n - 1) * 0.15}s`,
|
|
26
26
|
backgroundColor: loadingColor
|
|
27
27
|
}" />
|
|
28
|
-
</view>
|
|
28
|
+
</view> -->
|
|
29
29
|
<text v-if="loadingText" class="im-button__loading-text">
|
|
30
30
|
{{ loadingText }}
|
|
31
31
|
</text>
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
|
|
34
34
|
<!-- 图标 -->
|
|
35
35
|
<view v-if="(icon || $slots.icon) && !loading" class="im-button__icon">
|
|
36
|
-
<slot name="icon">
|
|
36
|
+
<slot v-if="$slots.icon" name="icon">
|
|
37
37
|
<image v-if="icon" :src="icon" class="im-button__icon-image"
|
|
38
38
|
:class="[`im-button__icon--${iconPosition}`]" mode="aspectFit" />
|
|
39
39
|
</slot>
|
|
40
|
+
<im-icon v-else-if="icon" :name="icon"></im-icon>
|
|
40
41
|
</view>
|
|
41
42
|
|
|
42
43
|
<!-- 文本内容 -->
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
|
|
64
65
|
<script setup lang="ts">
|
|
65
66
|
import { computed, withDefaults } from 'vue'
|
|
67
|
+
import { validator } from '../../index'
|
|
66
68
|
|
|
67
69
|
// 定义类型
|
|
68
70
|
type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
|
@@ -107,6 +109,7 @@ interface Props {
|
|
|
107
109
|
color?: string
|
|
108
110
|
bgColor?: string
|
|
109
111
|
borderColor?: string
|
|
112
|
+
border: boolean
|
|
110
113
|
textColor?: string
|
|
111
114
|
textSize?: TextSize
|
|
112
115
|
width?: string
|
|
@@ -170,6 +173,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
170
173
|
color: '',
|
|
171
174
|
bgColor: '',
|
|
172
175
|
borderColor: '',
|
|
176
|
+
border: true,
|
|
173
177
|
textColor: '',
|
|
174
178
|
width: '',
|
|
175
179
|
height: '',
|
|
@@ -196,13 +200,17 @@ const buttonStyles = computed(() => {
|
|
|
196
200
|
}
|
|
197
201
|
|
|
198
202
|
if (props.bgColor) {
|
|
199
|
-
styles.
|
|
203
|
+
styles.background = props.bgColor
|
|
200
204
|
}
|
|
201
205
|
|
|
202
206
|
if (props.borderColor) {
|
|
203
207
|
styles.borderColor = props.borderColor
|
|
204
208
|
}
|
|
205
209
|
|
|
210
|
+
if (!props.border) {
|
|
211
|
+
styles.border = '0 solid transparent'
|
|
212
|
+
}
|
|
213
|
+
|
|
206
214
|
if (props.textColor) {
|
|
207
215
|
styles.color = props.textColor
|
|
208
216
|
}
|
|
@@ -269,10 +277,11 @@ const loadingDotCount = computed(() => {
|
|
|
269
277
|
// 方法
|
|
270
278
|
const formatBadge = (badge: boolean | number | string): string => {
|
|
271
279
|
if (typeof badge === 'boolean') return ''
|
|
272
|
-
if (
|
|
273
|
-
return badge > 99 ? '99+' : badge.toString()
|
|
280
|
+
if (validator.isNumber(badge)) {
|
|
281
|
+
return Number(badge) > 99 ? '99+' : badge.toString()
|
|
274
282
|
}
|
|
275
|
-
|
|
283
|
+
badge = String(badge)
|
|
284
|
+
return badge.length > 2 ? `${badge.slice(0, 2)}...` : badge
|
|
276
285
|
}
|
|
277
286
|
|
|
278
287
|
// 事件处理
|
|
@@ -313,12 +322,16 @@ const onChooseAvatar = (detail: any) => {
|
|
|
313
322
|
</script>
|
|
314
323
|
|
|
315
324
|
<style lang="scss" scoped>
|
|
325
|
+
uni-button:after {
|
|
326
|
+
border: 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
316
329
|
.im-button {
|
|
317
330
|
position: relative;
|
|
318
331
|
display: inline-flex;
|
|
319
332
|
align-items: center;
|
|
320
333
|
justify-content: center;
|
|
321
|
-
border:
|
|
334
|
+
border: 1rpx solid transparent;
|
|
322
335
|
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
|
|
323
336
|
font-weight: 500;
|
|
324
337
|
text-align: center;
|
|
@@ -355,7 +368,7 @@ const onChooseAvatar = (detail: any) => {
|
|
|
355
368
|
// 细边框
|
|
356
369
|
&--hairline {
|
|
357
370
|
position: relative;
|
|
358
|
-
border-width:
|
|
371
|
+
// border-width: 1rpx;
|
|
359
372
|
|
|
360
373
|
&::after {
|
|
361
374
|
content: '';
|
|
@@ -364,7 +377,7 @@ const onChooseAvatar = (detail: any) => {
|
|
|
364
377
|
left: 0;
|
|
365
378
|
right: 0;
|
|
366
379
|
bottom: 0;
|
|
367
|
-
border:
|
|
380
|
+
border: 1rpx solid currentColor;//
|
|
368
381
|
border-radius: inherit;
|
|
369
382
|
pointer-events: none;
|
|
370
383
|
transform: scale(0.5);
|
|
@@ -396,6 +409,16 @@ const onChooseAvatar = (detail: any) => {
|
|
|
396
409
|
padding: 0 16rpx;
|
|
397
410
|
font-size: $im-font-size-mini;
|
|
398
411
|
border-radius: 20rpx;
|
|
412
|
+
|
|
413
|
+
// 形状
|
|
414
|
+
&--square {
|
|
415
|
+
border-radius: 8rpx;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
&--circle {
|
|
419
|
+
border-radius: 50%;
|
|
420
|
+
padding: 0 8rpx;
|
|
421
|
+
}
|
|
399
422
|
}
|
|
400
423
|
|
|
401
424
|
&--small {
|
|
@@ -403,6 +426,16 @@ const onChooseAvatar = (detail: any) => {
|
|
|
403
426
|
padding: 0 24rpx;
|
|
404
427
|
font-size: $im-font-size-small;
|
|
405
428
|
border-radius: 32rpx;
|
|
429
|
+
|
|
430
|
+
// 形状
|
|
431
|
+
&--square {
|
|
432
|
+
border-radius: 8rpx;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
&--circle {
|
|
436
|
+
border-radius: 50%;
|
|
437
|
+
padding: 0 12rpx;
|
|
438
|
+
}
|
|
406
439
|
}
|
|
407
440
|
|
|
408
441
|
&--medium {
|
|
@@ -410,6 +443,16 @@ const onChooseAvatar = (detail: any) => {
|
|
|
410
443
|
padding: 0 32rpx;
|
|
411
444
|
font-size: $im-font-size;
|
|
412
445
|
border-radius: 40rpx;
|
|
446
|
+
|
|
447
|
+
// 形状
|
|
448
|
+
&--square {
|
|
449
|
+
border-radius: 8rpx;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
&--circle {
|
|
453
|
+
border-radius: 50%;
|
|
454
|
+
padding: 0 16rpx;
|
|
455
|
+
}
|
|
413
456
|
}
|
|
414
457
|
|
|
415
458
|
&--large {
|
|
@@ -417,22 +460,16 @@ const onChooseAvatar = (detail: any) => {
|
|
|
417
460
|
padding: 0 40rpx;
|
|
418
461
|
font-size: $im-font-size-large;
|
|
419
462
|
border-radius: 48rpx;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// 形状
|
|
423
|
-
&--square {
|
|
424
|
-
border-radius: 8rpx;
|
|
425
|
-
}
|
|
426
463
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
464
|
+
// 形状
|
|
465
|
+
&--square {
|
|
466
|
+
border-radius: 8rpx;
|
|
467
|
+
}
|
|
430
468
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
min-width: var(--button-height);
|
|
469
|
+
&--circle {
|
|
470
|
+
border-radius: 50%;
|
|
471
|
+
padding: 0 20rpx;
|
|
472
|
+
}
|
|
436
473
|
}
|
|
437
474
|
|
|
438
475
|
// 类型
|
|
@@ -593,8 +630,8 @@ const onChooseAvatar = (detail: any) => {
|
|
|
593
630
|
|
|
594
631
|
&__badge {
|
|
595
632
|
position: absolute;
|
|
596
|
-
top:
|
|
597
|
-
right:
|
|
633
|
+
top: 6rpx;
|
|
634
|
+
right: 6rpx;
|
|
598
635
|
z-index: 1;
|
|
599
636
|
|
|
600
637
|
&-content {
|
|
@@ -604,17 +641,17 @@ const onChooseAvatar = (detail: any) => {
|
|
|
604
641
|
}
|
|
605
642
|
|
|
606
643
|
&--dot {
|
|
607
|
-
width:
|
|
608
|
-
height:
|
|
644
|
+
width: 12rpx;
|
|
645
|
+
height: 12rpx;
|
|
609
646
|
background-color: #fa3534;
|
|
610
647
|
border-radius: 50%;
|
|
611
648
|
border: 2rpx solid #ffffff;
|
|
612
649
|
}
|
|
613
650
|
|
|
614
651
|
&--text {
|
|
615
|
-
min-width:
|
|
616
|
-
height:
|
|
617
|
-
padding:
|
|
652
|
+
min-width: 16rpx;
|
|
653
|
+
height: 16rpx;
|
|
654
|
+
padding: 4rpx;
|
|
618
655
|
background-color: #fa3534;
|
|
619
656
|
border-radius: 16rpx;
|
|
620
657
|
border: 2rpx solid #ffffff;
|
|
@@ -622,7 +659,7 @@ const onChooseAvatar = (detail: any) => {
|
|
|
622
659
|
|
|
623
660
|
&-text {
|
|
624
661
|
color: #ffffff;
|
|
625
|
-
font-size:
|
|
662
|
+
font-size: 16rpx;
|
|
626
663
|
font-weight: bold;
|
|
627
664
|
line-height: 1;
|
|
628
665
|
}
|