hongkai-uni-ui 2.10.21 → 2.10.22
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/hk-button/hk-button.vue +475 -470
- package/components/hk-cell/hk-cell.vue +228 -228
- package/components/hk-download-progress/hk-download-progress.vue +259 -259
- package/components/hk-number-box/hk-number-box.vue +392 -392
- package/components/hk-picker-date/hk-picker-date.vue +299 -299
- package/components/hk-picker-simple/hk-picker-simple.vue +253 -253
- package/components/hk-scroll-view-new/hk-scroll-view-new.vue +358 -358
- package/components/hk-swiper/hk-swiper.vue +240 -240
- package/libs/utils/container.js +122 -122
- package/libs/utils/hk.js +18 -21
- package/libs/utils/route.js +118 -118
- package/libs/utils/storage.js +188 -188
- package/mixins/hkMixin.js +425 -425
- package/mixins/hkScrollView.js +340 -340
- package/package.json +1 -1
- package/version.js +1 -1
|
@@ -1,470 +1,475 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
import
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
* @
|
|
87
|
-
*
|
|
88
|
-
* @property {
|
|
89
|
-
* @property {String}
|
|
90
|
-
* @property {
|
|
91
|
-
* @property {
|
|
92
|
-
* @property {Boolean}
|
|
93
|
-
* @property {
|
|
94
|
-
* @property {
|
|
95
|
-
* @property {String | Number}
|
|
96
|
-
* @property {String}
|
|
97
|
-
* @property {String}
|
|
98
|
-
* @property {String}
|
|
99
|
-
* @property {
|
|
100
|
-
* @property {String}
|
|
101
|
-
* @property {
|
|
102
|
-
* @property {String}
|
|
103
|
-
* @property {String}
|
|
104
|
-
* @property {String}
|
|
105
|
-
* @property {
|
|
106
|
-
* @property {String}
|
|
107
|
-
* @property {
|
|
108
|
-
* @property {String
|
|
109
|
-
* @property {String | Number}
|
|
110
|
-
* @property {String | Number}
|
|
111
|
-
* @property {String}
|
|
112
|
-
* @property {String}
|
|
113
|
-
* @property {String}
|
|
114
|
-
* @property {
|
|
115
|
-
*
|
|
116
|
-
* @
|
|
117
|
-
*
|
|
118
|
-
* @event {Function}
|
|
119
|
-
* @event {Function}
|
|
120
|
-
* @event {Function}
|
|
121
|
-
* @event {Function}
|
|
122
|
-
* @event {Function}
|
|
123
|
-
* @
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
$hk-button-
|
|
289
|
-
$hk-button-
|
|
290
|
-
$hk-button-
|
|
291
|
-
$hk-button-
|
|
292
|
-
$hk-button-
|
|
293
|
-
$hk-button-
|
|
294
|
-
$hk-button-
|
|
295
|
-
$hk-button-
|
|
296
|
-
$hk-button-
|
|
297
|
-
$hk-button-
|
|
298
|
-
$hk-button-
|
|
299
|
-
$hk-button-
|
|
300
|
-
$hk-button-
|
|
301
|
-
$hk-button-
|
|
302
|
-
$hk-button-
|
|
303
|
-
$hk-button-
|
|
304
|
-
$hk-button-
|
|
305
|
-
$hk-button-
|
|
306
|
-
$hk-button-
|
|
307
|
-
$hk-button-
|
|
308
|
-
$hk-button-
|
|
309
|
-
$hk-button-
|
|
310
|
-
$hk-button-
|
|
311
|
-
$hk-button-
|
|
312
|
-
$hk-button-
|
|
313
|
-
$hk-button-
|
|
314
|
-
$hk-button-
|
|
315
|
-
$hk-button-
|
|
316
|
-
$hk-button-
|
|
317
|
-
$hk-button-
|
|
318
|
-
$hk-button-
|
|
319
|
-
$hk-button-
|
|
320
|
-
$hk-button-
|
|
321
|
-
$hk-button-
|
|
322
|
-
$hk-button-
|
|
323
|
-
$hk-button-
|
|
324
|
-
$hk-button-
|
|
325
|
-
$hk-button-
|
|
326
|
-
$hk-button-
|
|
327
|
-
$hk-button-
|
|
328
|
-
$hk-button-
|
|
329
|
-
$hk-button-
|
|
330
|
-
$hk-button-
|
|
331
|
-
$hk-button-
|
|
332
|
-
$hk-button-
|
|
333
|
-
$hk-button-
|
|
334
|
-
$hk-button-
|
|
335
|
-
$hk-button-
|
|
336
|
-
$hk-button-
|
|
337
|
-
$hk-button-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifndef APP-NVUE -->
|
|
3
|
+
<button
|
|
4
|
+
:hover-start-time="Number(hoverStartTime)"
|
|
5
|
+
:hover-stay-time="Number(hoverStayTime)"
|
|
6
|
+
:form-type="formType"
|
|
7
|
+
:open-type="openType"
|
|
8
|
+
:app-parameter="appParameter"
|
|
9
|
+
:hover-stop-propagation="hoverStopPropagation"
|
|
10
|
+
:send-message-title="sendMessageTitle"
|
|
11
|
+
:send-message-path="sendMessagePath"
|
|
12
|
+
:lang="lang"
|
|
13
|
+
:data-name="dataName"
|
|
14
|
+
:disabled="disabled"
|
|
15
|
+
:session-from="sessionFrom"
|
|
16
|
+
:send-message-img="sendMessageImg"
|
|
17
|
+
:show-message-card="showMessageCard"
|
|
18
|
+
@getphonenumber="getphonenumber"
|
|
19
|
+
@getrealtimephonenumber="getrealtimephonenumber"
|
|
20
|
+
@chooseavatar="chooseavatar"
|
|
21
|
+
@getuserinfo="getuserinfo"
|
|
22
|
+
@error="error"
|
|
23
|
+
@opensetting="opensetting"
|
|
24
|
+
@launchapp="launchapp"
|
|
25
|
+
@agreeprivacyauthorization="agreeprivacyauthorization"
|
|
26
|
+
:hover-class="!disabled && !loading ? 'hk-button--active' : ''"
|
|
27
|
+
class="hk-button hk-reset-button"
|
|
28
|
+
:style="[baseColor, $hk.addStyle(customStyle)]"
|
|
29
|
+
@tap="clickHandler"
|
|
30
|
+
:class="bemClass"
|
|
31
|
+
>
|
|
32
|
+
<template v-if="loading">
|
|
33
|
+
<hk-loading-icon :mode="loadingMode" :size="loadingSize * 1.15" :color="loadingColor"></hk-loading-icon>
|
|
34
|
+
<text class="hk-button__loading-text" :style="[{ fontSize: textSize + 'px' }]">{{ loadingText || text }}</text>
|
|
35
|
+
</template>
|
|
36
|
+
<template v-else>
|
|
37
|
+
<hk-icon-u v-if="icon" :name="icon" :color="iconColorCom" :size="textSize * 1.35" :customStyle="{ marginRight: '2px' }"></hk-icon-u>
|
|
38
|
+
<slot>
|
|
39
|
+
<text class="hk-button__text" :style="[{ fontSize: textSize + 'px' }]">{{ text }}</text>
|
|
40
|
+
</slot>
|
|
41
|
+
</template>
|
|
42
|
+
</button>
|
|
43
|
+
<!-- #endif -->
|
|
44
|
+
|
|
45
|
+
<!-- #ifdef APP-NVUE -->
|
|
46
|
+
<view
|
|
47
|
+
:hover-start-time="Number(hoverStartTime)"
|
|
48
|
+
:hover-stay-time="Number(hoverStayTime)"
|
|
49
|
+
class="hk-button"
|
|
50
|
+
:hover-class="
|
|
51
|
+
!disabled && !loading && !color && (plain || type === 'info') ? 'hk-button--active--plain' : !disabled && !loading && !plain ? 'hk-button--active' : ''
|
|
52
|
+
"
|
|
53
|
+
@tap="clickHandler"
|
|
54
|
+
:class="bemClass"
|
|
55
|
+
:style="[baseColor, $hk.addStyle(customStyle)]"
|
|
56
|
+
>
|
|
57
|
+
<template v-if="loading">
|
|
58
|
+
<hk-loading-icon :mode="loadingMode" :size="loadingSize * 1.15" :color="loadingColor"></hk-loading-icon>
|
|
59
|
+
<text class="hk-button__loading-text" :style="[nvueTextStyle]" :class="[plain && `hk-button__text--plain--${type}`]">{{ loadingText || text }}</text>
|
|
60
|
+
</template>
|
|
61
|
+
<template v-else>
|
|
62
|
+
<hk-icon-u v-if="icon" :name="icon" :color="iconColorCom" :size="textSize * 1.35"></hk-icon-u>
|
|
63
|
+
<text
|
|
64
|
+
class="hk-button__text"
|
|
65
|
+
:style="[
|
|
66
|
+
{
|
|
67
|
+
marginLeft: icon ? '2px' : 0
|
|
68
|
+
},
|
|
69
|
+
nvueTextStyle
|
|
70
|
+
]"
|
|
71
|
+
:class="[plain && `hk-button__text--plain--${type}`]"
|
|
72
|
+
>
|
|
73
|
+
{{ text }}
|
|
74
|
+
</text>
|
|
75
|
+
</template>
|
|
76
|
+
</view>
|
|
77
|
+
<!-- #endif -->
|
|
78
|
+
</template>
|
|
79
|
+
|
|
80
|
+
<script>
|
|
81
|
+
import button from '../../mixins/button.js';
|
|
82
|
+
import openType from '../../mixins/openType.js';
|
|
83
|
+
import props from './props.js';
|
|
84
|
+
/**
|
|
85
|
+
* button 按钮
|
|
86
|
+
* @description Button 按钮
|
|
87
|
+
*
|
|
88
|
+
* @property {Boolean} hairline 是否显示按钮的细边框 (默认 true )
|
|
89
|
+
* @property {String} type 按钮的预置样式,info,primary,error,warning,success (默认 'info' )
|
|
90
|
+
* @property {String} size 按钮尺寸,large,normal,mini (默认 normal)
|
|
91
|
+
* @property {String} shape 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' )
|
|
92
|
+
* @property {Boolean} plain 按钮是否镂空,背景色透明 (默认 false)
|
|
93
|
+
* @property {Boolean} disabled 是否禁用 (默认 false)
|
|
94
|
+
* @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈) (默认 false)
|
|
95
|
+
* @property {String | Number} loadingText 加载中提示文字
|
|
96
|
+
* @property {String} loadingMode 加载状态图标类型 (默认 'spinner' )
|
|
97
|
+
* @property {String | Number} loadingSize 加载图标大小 (默认 15 )
|
|
98
|
+
* @property {String} openType 开放能力,具体请看uniapp稳定关于button组件部分说明
|
|
99
|
+
* @property {String} formType 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
|
|
100
|
+
* @property {String} appParameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效)
|
|
101
|
+
* @property {Boolean} hoverStopPropagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效(默认 true )
|
|
102
|
+
* @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en )
|
|
103
|
+
* @property {String} sessionFrom 会话来源,openType="contact"时有效
|
|
104
|
+
* @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效
|
|
105
|
+
* @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效
|
|
106
|
+
* @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效
|
|
107
|
+
* @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效(默认false)
|
|
108
|
+
* @property {String} dataName 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
|
|
109
|
+
* @property {String | Number} throttleTime 节流,一定时间内只能触发一次 (默认 0 )
|
|
110
|
+
* @property {String | Number} hoverStartTime 按住后多久出现点击态,单位毫秒 (默认 0 )
|
|
111
|
+
* @property {String | Number} hoverStayTime 手指松开后点击态保留时间,单位毫秒 (默认 200 )
|
|
112
|
+
* @property {String | Number} text 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式)
|
|
113
|
+
* @property {String} icon 按钮图标
|
|
114
|
+
* @property {String} iconColor 按钮图标颜色
|
|
115
|
+
* @property {String} color 按钮颜色,支持传入linear-gradient渐变色
|
|
116
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
117
|
+
*
|
|
118
|
+
* @event {Function} click 非禁止并且非加载中,才能点击
|
|
119
|
+
* @event {Function} getphonenumber open-type="getPhoneNumber"时有效
|
|
120
|
+
* @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo
|
|
121
|
+
* @event {Function} error 当使用开放能力时,发生错误的回调
|
|
122
|
+
* @event {Function} opensetting 在打开授权设置页并关闭后回调
|
|
123
|
+
* @event {Function} agreePrivacyAuthorization 同意隐私协议回调
|
|
124
|
+
* @event {Function} launchapp 打开 APP 成功的回调
|
|
125
|
+
* @example <hk-button>月落</hk-button>
|
|
126
|
+
*/
|
|
127
|
+
export default {
|
|
128
|
+
name: 'hk-button',
|
|
129
|
+
// #ifdef MP
|
|
130
|
+
mixins: [uni.$hk.mpMixin, uni.$hk.mixin, button, openType, props],
|
|
131
|
+
// #endif
|
|
132
|
+
// #ifndef MP
|
|
133
|
+
mixins: [uni.$hk.mpMixin, uni.$hk.mixin, props],
|
|
134
|
+
// #endif
|
|
135
|
+
data() {
|
|
136
|
+
return {
|
|
137
|
+
throttleTimer: null
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
computed: {
|
|
141
|
+
// 生成bem风格的类名
|
|
142
|
+
bemClass() {
|
|
143
|
+
// this.bem为一个computed变量,在mixin中
|
|
144
|
+
if (!this.color) {
|
|
145
|
+
return this.bem('button', ['type', 'shape', 'size'], ['disabled', 'plain', 'hairline']);
|
|
146
|
+
} else {
|
|
147
|
+
// 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式
|
|
148
|
+
return this.bem('button', ['shape', 'size'], ['disabled', 'plain', 'hairline']);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
loadingColor() {
|
|
152
|
+
if (this.plain) {
|
|
153
|
+
// 如果有设置color值,则用color值,否则使用type主题颜色
|
|
154
|
+
return this.color ? this.color : uni.$hk.config.color[`hk-${this.type}`];
|
|
155
|
+
}
|
|
156
|
+
if (this.type === 'info') {
|
|
157
|
+
return '#c9c9c9';
|
|
158
|
+
}
|
|
159
|
+
return 'rgb(200, 200, 200)';
|
|
160
|
+
},
|
|
161
|
+
iconColorCom() {
|
|
162
|
+
// 如果是镂空状态,设置了color就用color值,否则使用主题颜色,
|
|
163
|
+
// hk-icon-u的color能接受一个主题颜色的值
|
|
164
|
+
if (this.iconColor) return this.iconColor;
|
|
165
|
+
if (this.plain) {
|
|
166
|
+
return this.color ? this.color : this.type;
|
|
167
|
+
} else {
|
|
168
|
+
return this.type === 'info' ? '#000000' : '#ffffff';
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
baseColor() {
|
|
172
|
+
let style = {};
|
|
173
|
+
if (this.color) {
|
|
174
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
175
|
+
style.color = this.plain ? this.color : 'white';
|
|
176
|
+
if (!this.plain) {
|
|
177
|
+
// 非镂空,背景色使用自定义的颜色
|
|
178
|
+
style['background-color'] = this.color;
|
|
179
|
+
}
|
|
180
|
+
if (this.color.indexOf('gradient') !== -1) {
|
|
181
|
+
// 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色
|
|
182
|
+
// weex文档说明可以写borderWidth的形式,为什么这里需要分开写?
|
|
183
|
+
// 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效
|
|
184
|
+
style.borderTopWidth = 0;
|
|
185
|
+
style.borderRightWidth = 0;
|
|
186
|
+
style.borderBottomWidth = 0;
|
|
187
|
+
style.borderLeftWidth = 0;
|
|
188
|
+
if (!this.plain) {
|
|
189
|
+
style.backgroundImage = this.color;
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
// 非渐变色,则设置边框相关的属性
|
|
193
|
+
style.borderColor = this.color;
|
|
194
|
+
style.borderWidth = '1px';
|
|
195
|
+
style.borderStyle = 'solid';
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return style;
|
|
199
|
+
},
|
|
200
|
+
// nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置
|
|
201
|
+
nvueTextStyle() {
|
|
202
|
+
let style = {};
|
|
203
|
+
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
|
204
|
+
if (this.type === 'info') {
|
|
205
|
+
style.color = '#323233';
|
|
206
|
+
}
|
|
207
|
+
if (this.color) {
|
|
208
|
+
style.color = this.plain ? this.color : 'white';
|
|
209
|
+
}
|
|
210
|
+
style.fontSize = this.textSize + 'px';
|
|
211
|
+
return style;
|
|
212
|
+
},
|
|
213
|
+
// 字体大小
|
|
214
|
+
textSize() {
|
|
215
|
+
let fontSize = 14,
|
|
216
|
+
{ size } = this;
|
|
217
|
+
if (size === 'large') fontSize = 16;
|
|
218
|
+
if (size === 'normal') fontSize = 14;
|
|
219
|
+
if (size === 'small') fontSize = 12;
|
|
220
|
+
if (size === 'mini') fontSize = 10;
|
|
221
|
+
return fontSize;
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
methods: {
|
|
225
|
+
clickHandler() {
|
|
226
|
+
// 非禁止并且非加载中,才能点击
|
|
227
|
+
if (!this.disabled && !this.loading) {
|
|
228
|
+
// 进行节流控制,每this.throttle毫秒内,只在开始处执行
|
|
229
|
+
this.throttleTimer && clearTimeout(this.throttleTimer);
|
|
230
|
+
this.throttleTimer = setTimeout(() => {
|
|
231
|
+
this.$emit('click');
|
|
232
|
+
}, this.throttleTime || 1000);
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
// 下面为对接uniapp官方按钮开放能力事件回调的对接
|
|
236
|
+
/**
|
|
237
|
+
* 快速获取手机号
|
|
238
|
+
* 手机号快速验证组件,平台会对号码进行验证,但不保证是实时验证。
|
|
239
|
+
* @param {Object} res
|
|
240
|
+
*/
|
|
241
|
+
getphonenumber(res) {
|
|
242
|
+
this.$emit('getphonenumber', res);
|
|
243
|
+
},
|
|
244
|
+
/**
|
|
245
|
+
* 实时验证手机号
|
|
246
|
+
* 手机号实时验证组件,在每次请求时,平台均会对用户选择的手机号进行实时验证;
|
|
247
|
+
* @param {Object} res
|
|
248
|
+
*/
|
|
249
|
+
getrealtimephonenumber(res) {
|
|
250
|
+
this.$emit('getrealtimephonenumber', res);
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* 获取用户选择的头像
|
|
254
|
+
*/
|
|
255
|
+
chooseavatar() {
|
|
256
|
+
this.$emit('chooseavatar', res);
|
|
257
|
+
},
|
|
258
|
+
getuserinfo(res) {
|
|
259
|
+
this.$emit('getuserinfo', res);
|
|
260
|
+
},
|
|
261
|
+
error(res) {
|
|
262
|
+
this.$emit('error', res);
|
|
263
|
+
},
|
|
264
|
+
opensetting(res) {
|
|
265
|
+
this.$emit('opensetting', res);
|
|
266
|
+
},
|
|
267
|
+
launchapp(res) {
|
|
268
|
+
this.$emit('launchapp', res);
|
|
269
|
+
},
|
|
270
|
+
agreeprivacyauthorization(res) {
|
|
271
|
+
this.$emit('agreeprivacyauthorization', res);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
</script>
|
|
276
|
+
|
|
277
|
+
<style lang="scss" scoped>
|
|
278
|
+
@import '../../styles/components.scss';
|
|
279
|
+
|
|
280
|
+
/* #ifndef APP-NVUE */
|
|
281
|
+
@import './vue.scss';
|
|
282
|
+
/* #endif */
|
|
283
|
+
|
|
284
|
+
/* #ifdef APP-NVUE */
|
|
285
|
+
@import './nvue.scss';
|
|
286
|
+
/* #endif */
|
|
287
|
+
|
|
288
|
+
$hk-button-hk-button-height: 40px !default;
|
|
289
|
+
$hk-button-text-font-size: 15px !default;
|
|
290
|
+
$hk-button-loading-text-font-size: 15px !default;
|
|
291
|
+
$hk-button-loading-text-margin-left: 4px !default;
|
|
292
|
+
$hk-button-large-width: 100% !default;
|
|
293
|
+
$hk-button-large-height: 50px !default;
|
|
294
|
+
$hk-button-normal-padding: 0 12px !default;
|
|
295
|
+
$hk-button-large-padding: 0 15px !default;
|
|
296
|
+
$hk-button-normal-font-size: 14px !default;
|
|
297
|
+
$hk-button-small-min-width: 60px !default;
|
|
298
|
+
$hk-button-small-height: 30px !default;
|
|
299
|
+
$hk-button-small-padding: 0px 8px !default;
|
|
300
|
+
$hk-button-mini-padding: 0px 8px !default;
|
|
301
|
+
$hk-button-small-font-size: 12px !default;
|
|
302
|
+
$hk-button-mini-height: 22px !default;
|
|
303
|
+
$hk-button-mini-font-size: 10px !default;
|
|
304
|
+
$hk-button-mini-min-width: 50px !default;
|
|
305
|
+
$hk-button-disabled-opacity: 0.8 !default;
|
|
306
|
+
$hk-button-info-color: #323233 !default;
|
|
307
|
+
$hk-button-info-background-color: #fff !default;
|
|
308
|
+
$hk-button-info-border-color: #ebedf0 !default;
|
|
309
|
+
$hk-button-info-border-width: 1px !default;
|
|
310
|
+
$hk-button-info-border-style: solid !default;
|
|
311
|
+
$hk-button-success-color: #fff !default;
|
|
312
|
+
$hk-button-success-background-color: $hk-success !default;
|
|
313
|
+
$hk-button-success-border-color: $hk-button-success-background-color !default;
|
|
314
|
+
$hk-button-success-border-width: 1px !default;
|
|
315
|
+
$hk-button-success-border-style: solid !default;
|
|
316
|
+
$hk-button-primary-color: #fff !default;
|
|
317
|
+
$hk-button-primary-background-color: $hk-primary !default;
|
|
318
|
+
$hk-button-primary-border-color: $hk-button-primary-background-color !default;
|
|
319
|
+
$hk-button-primary-border-width: 1px !default;
|
|
320
|
+
$hk-button-primary-border-style: solid !default;
|
|
321
|
+
$hk-button-error-color: #fff !default;
|
|
322
|
+
$hk-button-error-background-color: $hk-error !default;
|
|
323
|
+
$hk-button-error-border-color: $hk-button-error-background-color !default;
|
|
324
|
+
$hk-button-error-border-width: 1px !default;
|
|
325
|
+
$hk-button-error-border-style: solid !default;
|
|
326
|
+
$hk-button-warning-color: #fff !default;
|
|
327
|
+
$hk-button-warning-background-color: $hk-warning !default;
|
|
328
|
+
$hk-button-warning-border-color: $hk-button-warning-background-color !default;
|
|
329
|
+
$hk-button-warning-border-width: 1px !default;
|
|
330
|
+
$hk-button-warning-border-style: solid !default;
|
|
331
|
+
$hk-button-block-width: 100% !default;
|
|
332
|
+
$hk-button-circle-border-top-right-radius: 100px !default;
|
|
333
|
+
$hk-button-circle-border-top-left-radius: 100px !default;
|
|
334
|
+
$hk-button-circle-border-bottom-left-radius: 100px !default;
|
|
335
|
+
$hk-button-circle-border-bottom-right-radius: 100px !default;
|
|
336
|
+
$hk-button-square-border-top-right-radius: 3px !default;
|
|
337
|
+
$hk-button-square-border-top-left-radius: 3px !default;
|
|
338
|
+
$hk-button-square-border-bottom-left-radius: 3px !default;
|
|
339
|
+
$hk-button-square-border-bottom-right-radius: 3px !default;
|
|
340
|
+
$hk-button-icon-min-width: 1em !default;
|
|
341
|
+
$hk-button-plain-background-color: #fff !default;
|
|
342
|
+
$hk-button-hairline-border-width: 0.5px !default;
|
|
343
|
+
|
|
344
|
+
.hk-button {
|
|
345
|
+
height: $hk-button-hk-button-height;
|
|
346
|
+
position: relative;
|
|
347
|
+
align-items: center;
|
|
348
|
+
justify-content: center;
|
|
349
|
+
@include flex;
|
|
350
|
+
/* #ifndef APP-NVUE */
|
|
351
|
+
box-sizing: border-box;
|
|
352
|
+
/* #endif */
|
|
353
|
+
flex-direction: row;
|
|
354
|
+
|
|
355
|
+
&__text {
|
|
356
|
+
font-size: $hk-button-text-font-size;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&__loading-text {
|
|
360
|
+
font-size: $hk-button-loading-text-font-size;
|
|
361
|
+
margin-left: $hk-button-loading-text-margin-left;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
&--large {
|
|
365
|
+
/* #ifndef APP-NVUE */
|
|
366
|
+
width: $hk-button-large-width;
|
|
367
|
+
/* #endif */
|
|
368
|
+
height: $hk-button-large-height;
|
|
369
|
+
padding: $hk-button-large-padding;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
&--normal {
|
|
373
|
+
padding: $hk-button-normal-padding;
|
|
374
|
+
font-size: $hk-button-normal-font-size;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
&--small {
|
|
378
|
+
/* #ifndef APP-NVUE */
|
|
379
|
+
min-width: $hk-button-small-min-width;
|
|
380
|
+
/* #endif */
|
|
381
|
+
height: $hk-button-small-height;
|
|
382
|
+
padding: $hk-button-small-padding;
|
|
383
|
+
font-size: $hk-button-small-font-size;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
&--mini {
|
|
387
|
+
height: $hk-button-mini-height;
|
|
388
|
+
font-size: $hk-button-mini-font-size;
|
|
389
|
+
/* #ifndef APP-NVUE */
|
|
390
|
+
min-width: $hk-button-mini-min-width;
|
|
391
|
+
/* #endif */
|
|
392
|
+
padding: $hk-button-mini-padding;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
&--disabled {
|
|
396
|
+
opacity: $hk-button-disabled-opacity;
|
|
397
|
+
border-color: transparent !important;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
&--info {
|
|
401
|
+
color: $hk-button-info-color;
|
|
402
|
+
background-color: $hk-button-info-background-color;
|
|
403
|
+
border-color: $hk-button-info-border-color;
|
|
404
|
+
border-width: $hk-button-info-border-width;
|
|
405
|
+
border-style: $hk-button-info-border-style;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
&--success {
|
|
409
|
+
color: $hk-button-success-color;
|
|
410
|
+
background-color: $hk-button-success-background-color;
|
|
411
|
+
border-color: $hk-button-success-border-color;
|
|
412
|
+
border-width: $hk-button-success-border-width;
|
|
413
|
+
border-style: $hk-button-success-border-style;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
&--primary {
|
|
417
|
+
color: $hk-button-primary-color;
|
|
418
|
+
background-color: $hk-button-primary-background-color;
|
|
419
|
+
border-color: $hk-button-primary-border-color;
|
|
420
|
+
border-width: $hk-button-primary-border-width;
|
|
421
|
+
border-style: $hk-button-primary-border-style;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
&--error {
|
|
425
|
+
color: $hk-button-error-color;
|
|
426
|
+
background-color: $hk-button-error-background-color;
|
|
427
|
+
border-color: $hk-button-error-border-color;
|
|
428
|
+
border-width: $hk-button-error-border-width;
|
|
429
|
+
border-style: $hk-button-error-border-style;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
&--warning {
|
|
433
|
+
color: $hk-button-warning-color;
|
|
434
|
+
background-color: $hk-button-warning-background-color;
|
|
435
|
+
border-color: $hk-button-warning-border-color;
|
|
436
|
+
border-width: $hk-button-warning-border-width;
|
|
437
|
+
border-style: $hk-button-warning-border-style;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
&--block {
|
|
441
|
+
@include flex;
|
|
442
|
+
width: $hk-button-block-width;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
&--circle {
|
|
446
|
+
border-top-right-radius: $hk-button-circle-border-top-right-radius;
|
|
447
|
+
border-top-left-radius: $hk-button-circle-border-top-left-radius;
|
|
448
|
+
border-bottom-left-radius: $hk-button-circle-border-bottom-left-radius;
|
|
449
|
+
border-bottom-right-radius: $hk-button-circle-border-bottom-right-radius;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
&--square {
|
|
453
|
+
border-bottom-left-radius: $hk-button-square-border-top-right-radius;
|
|
454
|
+
border-bottom-right-radius: $hk-button-square-border-top-left-radius;
|
|
455
|
+
border-top-left-radius: $hk-button-square-border-bottom-left-radius;
|
|
456
|
+
border-top-right-radius: $hk-button-square-border-bottom-right-radius;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
&__icon {
|
|
460
|
+
/* #ifndef APP-NVUE */
|
|
461
|
+
min-width: $hk-button-icon-min-width;
|
|
462
|
+
line-height: inherit !important;
|
|
463
|
+
vertical-align: top;
|
|
464
|
+
/* #endif */
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
&--plain {
|
|
468
|
+
background-color: $hk-button-plain-background-color;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
&--hairline {
|
|
472
|
+
border-width: $hk-button-hairline-border-width !important;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
</style>
|