@vtj/materials 0.10.1-alpha.5 → 0.10.1-alpha.7

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.
Files changed (92) hide show
  1. package/dist/assets/antdv/index.umd.js +2 -2
  2. package/dist/assets/charts/index.umd.js +2 -2
  3. package/dist/assets/element/index.umd.js +2 -2
  4. package/dist/assets/ui/index.umd.js +2 -2
  5. package/dist/assets/uni-h5/index.umd.js +2 -2
  6. package/dist/assets/uni-ui/index.umd.js +3 -3
  7. package/dist/assets/vant/index.umd.js +2 -2
  8. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  9. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  10. package/dist/deps/@vtj/ui/index.umd.js +2 -2
  11. package/dist/deps/@vtj/utils/index.umd.js +2 -2
  12. package/dist/deps/uni-h5/style.css +1 -1
  13. package/dist/deps/uni-ui/index.umd.js +1 -1
  14. package/dist/deps/uni-ui/style.css +1 -1
  15. package/package.json +5 -5
  16. package/src/uni-h5/style.scss +0 -1
  17. package/src/uni-ui/components/badge.ts +5 -1
  18. package/src/uni-ui/components/breadcrumb.ts +76 -0
  19. package/src/uni-ui/components/calendar.ts +63 -0
  20. package/src/uni-ui/components/card.ts +113 -0
  21. package/src/uni-ui/components/collapse.ts +118 -0
  22. package/src/uni-ui/components/combox.ts +51 -0
  23. package/src/uni-ui/components/countdown.ts +92 -0
  24. package/src/uni-ui/components/dataCheckbox.ts +104 -0
  25. package/src/uni-ui/components/dataPicker.ts +146 -0
  26. package/src/uni-ui/components/dataSelect.ts +68 -0
  27. package/src/uni-ui/components/dateformat.ts +42 -0
  28. package/src/uni-ui/components/datetimePicker.ts +103 -0
  29. package/src/uni-ui/components/drawer.ts +38 -0
  30. package/src/uni-ui/components/easyinput.ts +159 -0
  31. package/src/uni-ui/components/fab.ts +89 -0
  32. package/src/uni-ui/components/fav.ts +65 -0
  33. package/src/uni-ui/components/filePicker.ts +127 -0
  34. package/src/uni-ui/components/forms.ts +209 -0
  35. package/src/uni-ui/components/goodsNav.ts +31 -0
  36. package/src/uni-ui/components/grid.ts +104 -0
  37. package/src/uni-ui/components/group.ts +50 -0
  38. package/src/uni-ui/components/icons.ts +47 -0
  39. package/src/uni-ui/components/index.ts +89 -1
  40. package/src/uni-ui/components/indexedList.ts +51 -0
  41. package/src/uni-ui/components/link.ts +60 -0
  42. package/src/uni-ui/components/list.ts +259 -0
  43. package/src/uni-ui/components/loadMore.ts +61 -0
  44. package/src/uni-ui/components/navbar.ts +121 -0
  45. package/src/uni-ui/components/noticeBar.ts +83 -0
  46. package/src/uni-ui/components/numberbox.ts +49 -0
  47. package/src/uni-ui/components/pagination.ts +59 -0
  48. package/src/uni-ui/components/popup.ts +206 -0
  49. package/src/uni-ui/components/rate.ts +89 -0
  50. package/src/uni-ui/components/row.ts +126 -0
  51. package/src/uni-ui/components/searchBar.ts +84 -0
  52. package/src/uni-ui/components/section.ts +68 -0
  53. package/src/uni-ui/components/segmentedControl.ts +48 -0
  54. package/src/uni-ui/components/steps.ts +55 -0
  55. package/src/uni-ui/components/swipeAction.ts +133 -0
  56. package/src/uni-ui/components/swiperDot.ts +114 -0
  57. package/src/uni-ui/components/table.ts +132 -0
  58. package/src/uni-ui/components/tag.ts +56 -0
  59. package/src/uni-ui/components/title.ts +49 -0
  60. package/src/uni-ui/components/tooltip.ts +32 -0
  61. package/src/uni-ui/components/transition.ts +49 -0
  62. package/src/uni-ui/index.ts +30 -13
  63. package/src/uni-ui/lib/uni-col/uni-col.vue +324 -0
  64. package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +590 -0
  65. package/src/uni-ui/lib/uni-easyinput/common.js +54 -0
  66. package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +790 -0
  67. package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +630 -0
  68. package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +6 -0
  69. package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +8 -0
  70. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +6 -0
  71. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +6 -0
  72. package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +231 -0
  73. package/src/uni-ui/lib/uni-icons/uni-icons.uvue +91 -0
  74. package/src/uni-ui/lib/uni-icons/uni-icons.vue +114 -0
  75. package/src/uni-ui/lib/uni-icons/uniicons.css +664 -0
  76. package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
  77. package/src/uni-ui/lib/uni-icons/uniicons_file.ts +664 -0
  78. package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +649 -0
  79. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  80. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +404 -0
  81. package/src/uni-ui/lib/uni-list/uni-list.vue +123 -0
  82. package/src/uni-ui/lib/uni-list/uni-refresh.vue +65 -0
  83. package/src/uni-ui/lib/uni-list/uni-refresh.wxs +87 -0
  84. package/src/uni-ui/lib/uni-popup-dialog/keypress.js +45 -0
  85. package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +324 -0
  86. package/src/uni-ui/lib/uni-rate/uni-rate.vue +361 -0
  87. package/src/uni-ui/lib/uni-table/uni-table.vue +496 -0
  88. package/src/uni-ui/lib/uni-td/uni-td.vue +99 -0
  89. package/src/uni-ui/lib/uni-th/uni-th.vue +310 -283
  90. package/src/uni-ui/lib/uni-tr/uni-tr.vue +194 -170
  91. package/src/version.ts +2 -2
  92. package/dist/deps/@vtj/uni/index.umd.js +0 -7
@@ -0,0 +1,590 @@
1
+ <template>
2
+ <view class="uni-stat__select">
3
+ <span v-if="label" class="uni-label-text hide-on-phone">{{
4
+ label + ':'
5
+ }}</span>
6
+ <view class="uni-stat-box" :class="{ 'uni-stat__actived': current }">
7
+ <view class="uni-select" :class="{ 'uni-select--disabled': disabled }">
8
+ <view class="uni-select__input-box" @click="toggleSelector">
9
+ <view v-if="current" class="uni-select__input-text">{{
10
+ textShow
11
+ }}</view>
12
+ <view
13
+ v-else
14
+ class="uni-select__input-text uni-select__input-placeholder"
15
+ >{{ typePlaceholder }}</view
16
+ >
17
+ <view v-if="current && clear && !disabled" @click.stop="clearVal">
18
+ <uni-icons type="clear" color="#c0c4cc" size="24" />
19
+ </view>
20
+ <view v-else>
21
+ <uni-icons
22
+ :type="showSelector ? 'top' : 'bottom'"
23
+ size="14"
24
+ color="#999" />
25
+ </view>
26
+ </view>
27
+ <view
28
+ class="uni-select--mask"
29
+ v-if="showSelector"
30
+ @click="toggleSelector" />
31
+ <view
32
+ class="uni-select__selector"
33
+ :style="getOffsetByPlacement"
34
+ v-if="showSelector">
35
+ <view
36
+ :class="
37
+ placement == 'bottom'
38
+ ? 'uni-popper__arrow_bottom'
39
+ : 'uni-popper__arrow_top'
40
+ "></view>
41
+ <scroll-view scroll-y="true" class="uni-select__selector-scroll">
42
+ <view
43
+ class="uni-select__selector-empty"
44
+ v-if="mixinDatacomResData.length === 0">
45
+ <text>{{ emptyTips }}</text>
46
+ </view>
47
+ <view
48
+ v-else
49
+ class="uni-select__selector-item"
50
+ v-for="(item, index) in mixinDatacomResData"
51
+ :key="index"
52
+ @click="change(item)">
53
+ <text :class="{ 'uni-select__selector__disabled': item.disable }"
54
+ >{{ formatItemName(item) }}</text
55
+ >
56
+ </view>
57
+ </scroll-view>
58
+ </view>
59
+ </view>
60
+ </view>
61
+ </view>
62
+ </template>
63
+
64
+ <script>
65
+ /**
66
+ * DataChecklist 数据选择器
67
+ * @description 通过数据渲染的下拉框组件
68
+ * @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
69
+ * @property {String} value 默认值
70
+ * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
71
+ * @property {Boolean} clear 是否可以清空已选项
72
+ * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
73
+ * @property {String} label 左侧标题
74
+ * @property {String} placeholder 输入框的提示文字
75
+ * @property {Boolean} disabled 是否禁用
76
+ * @property {String} placement 弹出位置
77
+ * @value top 顶部弹出
78
+ * @value bottom 底部弹出(default)
79
+ * @event {Function} change 选中发生变化触发
80
+ */
81
+
82
+ export default {
83
+ name: 'uni-data-select',
84
+ mixins: [uniCloud.mixinDatacom || {}],
85
+ props: {
86
+ localdata: {
87
+ type: Array,
88
+ default() {
89
+ return [];
90
+ }
91
+ },
92
+ value: {
93
+ type: [String, Number],
94
+ default: ''
95
+ },
96
+ modelValue: {
97
+ type: [String, Number],
98
+ default: ''
99
+ },
100
+ label: {
101
+ type: String,
102
+ default: ''
103
+ },
104
+ placeholder: {
105
+ type: String,
106
+ default: '请选择'
107
+ },
108
+ emptyTips: {
109
+ type: String,
110
+ default: '无选项'
111
+ },
112
+ clear: {
113
+ type: Boolean,
114
+ default: true
115
+ },
116
+ defItem: {
117
+ type: Number,
118
+ default: 0
119
+ },
120
+ disabled: {
121
+ type: Boolean,
122
+ default: false
123
+ },
124
+ // 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
125
+ format: {
126
+ type: String,
127
+ default: ''
128
+ },
129
+ placement: {
130
+ type: String,
131
+ default: 'bottom'
132
+ }
133
+ },
134
+ data() {
135
+ return {
136
+ showSelector: false,
137
+ current: '',
138
+ mixinDatacomResData: [],
139
+ apps: [],
140
+ channels: [],
141
+ cacheKey: 'uni-data-select-lastSelectedValue'
142
+ };
143
+ },
144
+ created() {
145
+ this.debounceGet = this.debounce(() => {
146
+ this.query();
147
+ }, 300);
148
+ if (this.collection && !this.localdata.length) {
149
+ this.debounceGet();
150
+ }
151
+ },
152
+ computed: {
153
+ typePlaceholder() {
154
+ const text = {
155
+ 'opendb-stat-app-versions': '版本',
156
+ 'opendb-app-channels': '渠道',
157
+ 'opendb-app-list': '应用'
158
+ };
159
+ const common = this.placeholder;
160
+ const placeholder = text[this.collection];
161
+ return placeholder ? common + placeholder : common;
162
+ },
163
+ valueCom() {
164
+ // #ifdef VUE3
165
+ return this.modelValue;
166
+ // #endif
167
+ // #ifndef VUE3
168
+ // return this.value;
169
+ // #endif
170
+ },
171
+ textShow() {
172
+ // 长文本显示
173
+ let text = this.current;
174
+ return text;
175
+ },
176
+ getOffsetByPlacement() {
177
+ switch (this.placement) {
178
+ case 'top':
179
+ return 'bottom:calc(100% + 12px);';
180
+ case 'bottom':
181
+ return 'top:calc(100% + 12px);';
182
+ }
183
+ }
184
+ },
185
+
186
+ watch: {
187
+ localdata: {
188
+ immediate: true,
189
+ handler(val, old) {
190
+ if (Array.isArray(val) && old !== val) {
191
+ this.mixinDatacomResData = val;
192
+ }
193
+ }
194
+ },
195
+ valueCom(val, old) {
196
+ this.initDefVal();
197
+ },
198
+ mixinDatacomResData: {
199
+ immediate: true,
200
+ handler(val) {
201
+ if (val.length) {
202
+ this.initDefVal();
203
+ }
204
+ }
205
+ }
206
+ },
207
+ methods: {
208
+ debounce(fn, time = 100) {
209
+ let timer = null;
210
+ return function (...args) {
211
+ if (timer) clearTimeout(timer);
212
+ timer = setTimeout(() => {
213
+ fn.apply(this, args);
214
+ }, time);
215
+ };
216
+ },
217
+ // 执行数据库查询
218
+ query() {
219
+ this.mixinDatacomEasyGet();
220
+ },
221
+ // 监听查询条件变更事件
222
+ onMixinDatacomPropsChange() {
223
+ if (this.collection) {
224
+ this.debounceGet();
225
+ }
226
+ },
227
+ initDefVal() {
228
+ let defValue = '';
229
+ if (
230
+ (this.valueCom || this.valueCom === 0) &&
231
+ !this.isDisabled(this.valueCom)
232
+ ) {
233
+ defValue = this.valueCom;
234
+ } else {
235
+ let strogeValue;
236
+ if (this.collection) {
237
+ strogeValue = this.getCache();
238
+ }
239
+ if (strogeValue || strogeValue === 0) {
240
+ defValue = strogeValue;
241
+ } else {
242
+ let defItem = '';
243
+ if (
244
+ this.defItem > 0 &&
245
+ this.defItem <= this.mixinDatacomResData.length
246
+ ) {
247
+ defItem = this.mixinDatacomResData[this.defItem - 1].value;
248
+ }
249
+ defValue = defItem;
250
+ }
251
+ if (defValue || defValue === 0) {
252
+ this.emit(defValue);
253
+ }
254
+ }
255
+ const def = this.mixinDatacomResData.find(
256
+ (item) => item.value === defValue
257
+ );
258
+ this.current = def ? this.formatItemName(def) : '';
259
+ },
260
+
261
+ /**
262
+ * @param {[String, Number]} value
263
+ * 判断用户给的 value 是否同时为禁用状态
264
+ */
265
+ isDisabled(value) {
266
+ let isDisabled = false;
267
+
268
+ this.mixinDatacomResData.forEach((item) => {
269
+ if (item.value === value) {
270
+ isDisabled = item.disable;
271
+ }
272
+ });
273
+
274
+ return isDisabled;
275
+ },
276
+
277
+ clearVal() {
278
+ this.emit('');
279
+ if (this.collection) {
280
+ this.removeCache();
281
+ }
282
+ },
283
+ change(item) {
284
+ if (!item.disable) {
285
+ this.showSelector = false;
286
+ this.current = this.formatItemName(item);
287
+ this.emit(item.value);
288
+ }
289
+ },
290
+ emit(val) {
291
+ this.$emit('input', val);
292
+ this.$emit('update:modelValue', val);
293
+ this.$emit('change', val);
294
+ if (this.collection) {
295
+ this.setCache(val);
296
+ }
297
+ },
298
+ toggleSelector() {
299
+ if (this.disabled) {
300
+ return;
301
+ }
302
+
303
+ this.showSelector = !this.showSelector;
304
+ },
305
+ formatItemName(item) {
306
+ let { text, value, channel_code } = item;
307
+ channel_code = channel_code ? `(${channel_code})` : '';
308
+
309
+ if (this.format) {
310
+ // 格式化输出
311
+ let str = '';
312
+ str = this.format;
313
+ for (let key in item) {
314
+ str = str.replace(new RegExp(`{${key}}`, 'g'), item[key]);
315
+ }
316
+ return str;
317
+ } else {
318
+ return text;
319
+ // return this.collection.indexOf('app-list') > 0 ?
320
+ // `${text}(${value})` :
321
+ // (
322
+ // text ?
323
+ // text :
324
+ // `未命名${channel_code}`
325
+ // )
326
+ }
327
+ },
328
+ // 获取当前加载的数据
329
+ getLoadData() {
330
+ return this.mixinDatacomResData;
331
+ },
332
+ // 获取当前缓存key
333
+ getCurrentCacheKey() {
334
+ return this.collection;
335
+ },
336
+ // 获取缓存
337
+ getCache(name = this.getCurrentCacheKey()) {
338
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
339
+ return cacheData[name];
340
+ },
341
+ // 设置缓存
342
+ setCache(value, name = this.getCurrentCacheKey()) {
343
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
344
+ cacheData[name] = value;
345
+ uni.setStorageSync(this.cacheKey, cacheData);
346
+ },
347
+ // 删除缓存
348
+ removeCache(name = this.getCurrentCacheKey()) {
349
+ let cacheData = uni.getStorageSync(this.cacheKey) || {};
350
+ delete cacheData[name];
351
+ uni.setStorageSync(this.cacheKey, cacheData);
352
+ }
353
+ }
354
+ };
355
+ </script>
356
+
357
+ <style lang="scss">
358
+ $uni-base-color: #6a6a6a !default;
359
+ $uni-main-color: #333 !default;
360
+ $uni-secondary-color: #909399 !default;
361
+ $uni-border-3: #e5e5e5;
362
+
363
+ /* #ifndef APP-NVUE */
364
+ @media screen and (max-width: 500px) {
365
+ .hide-on-phone {
366
+ display: none;
367
+ }
368
+ }
369
+
370
+ /* #endif */
371
+ .uni-stat__select {
372
+ display: flex;
373
+ align-items: center;
374
+ // padding: 15px;
375
+ /* #ifdef H5 */
376
+ cursor: pointer;
377
+ /* #endif */
378
+ width: 100%;
379
+ flex: 1;
380
+ box-sizing: border-box;
381
+ }
382
+
383
+ .uni-stat-box {
384
+ width: 100%;
385
+ flex: 1;
386
+ }
387
+
388
+ .uni-stat__actived {
389
+ width: 100%;
390
+ flex: 1;
391
+ // outline: 1px solid #2979ff;
392
+ }
393
+
394
+ .uni-label-text {
395
+ font-size: 14px;
396
+ font-weight: bold;
397
+ color: $uni-base-color;
398
+ margin: auto 0;
399
+ margin-right: 5px;
400
+ }
401
+
402
+ .uni-select {
403
+ font-size: 14px;
404
+ border: 1px solid $uni-border-3;
405
+ box-sizing: border-box;
406
+ border-radius: 4px;
407
+ padding: 0 5px;
408
+ padding-left: 10px;
409
+ position: relative;
410
+ /* #ifndef APP-NVUE */
411
+ display: flex;
412
+ user-select: none;
413
+ /* #endif */
414
+ flex-direction: row;
415
+ align-items: center;
416
+ border-bottom: solid 1px $uni-border-3;
417
+ width: 100%;
418
+ flex: 1;
419
+ height: 35px;
420
+
421
+ &--disabled {
422
+ background-color: #f5f7fa;
423
+ cursor: not-allowed;
424
+ }
425
+ }
426
+
427
+ .uni-select__label {
428
+ font-size: 16px;
429
+ // line-height: 22px;
430
+ height: 35px;
431
+ padding-right: 10px;
432
+ color: $uni-secondary-color;
433
+ }
434
+
435
+ .uni-select__input-box {
436
+ height: 35px;
437
+ width: 0px;
438
+ position: relative;
439
+ /* #ifndef APP-NVUE */
440
+ display: flex;
441
+ /* #endif */
442
+ flex: 1;
443
+ flex-direction: row;
444
+ align-items: center;
445
+ }
446
+
447
+ .uni-select__input {
448
+ flex: 1;
449
+ font-size: 14px;
450
+ height: 22px;
451
+ line-height: 22px;
452
+ }
453
+
454
+ .uni-select__input-plac {
455
+ font-size: 14px;
456
+ color: $uni-secondary-color;
457
+ }
458
+
459
+ .uni-select__selector {
460
+ /* #ifndef APP-NVUE */
461
+ box-sizing: border-box;
462
+ /* #endif */
463
+ position: absolute;
464
+ left: 0;
465
+ width: 100%;
466
+ background-color: #ffffff;
467
+ border: 1px solid #ebeef5;
468
+ border-radius: 6px;
469
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
470
+ z-index: 3;
471
+ padding: 4px 0;
472
+ }
473
+
474
+ .uni-select__selector-scroll {
475
+ /* #ifndef APP-NVUE */
476
+ max-height: 200px;
477
+ box-sizing: border-box;
478
+ /* #endif */
479
+ }
480
+
481
+ /* #ifdef H5 */
482
+ @media (min-width: 768px) {
483
+ .uni-select__selector-scroll {
484
+ max-height: 600px;
485
+ }
486
+ }
487
+
488
+ /* #endif */
489
+
490
+ .uni-select__selector-empty,
491
+ .uni-select__selector-item {
492
+ /* #ifndef APP-NVUE */
493
+ display: flex;
494
+ cursor: pointer;
495
+ /* #endif */
496
+ line-height: 35px;
497
+ font-size: 14px;
498
+ text-align: center;
499
+ /* border-bottom: solid 1px $uni-border-3; */
500
+ padding: 0px 10px;
501
+ }
502
+
503
+ .uni-select__selector-item:hover {
504
+ background-color: #f9f9f9;
505
+ }
506
+
507
+ .uni-select__selector-empty:last-child,
508
+ .uni-select__selector-item:last-child {
509
+ /* #ifndef APP-NVUE */
510
+ border-bottom: none;
511
+ /* #endif */
512
+ }
513
+
514
+ .uni-select__selector__disabled {
515
+ opacity: 0.4;
516
+ cursor: default;
517
+ }
518
+
519
+ /* picker 弹出层通用的指示小三角 */
520
+ .uni-popper__arrow_bottom,
521
+ .uni-popper__arrow_bottom::after,
522
+ .uni-popper__arrow_top,
523
+ .uni-popper__arrow_top::after {
524
+ position: absolute;
525
+ display: block;
526
+ width: 0;
527
+ height: 0;
528
+ border-color: transparent;
529
+ border-style: solid;
530
+ border-width: 6px;
531
+ }
532
+
533
+ .uni-popper__arrow_bottom {
534
+ filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
535
+ top: -6px;
536
+ left: 10%;
537
+ margin-right: 3px;
538
+ border-top-width: 0;
539
+ border-bottom-color: #ebeef5;
540
+ }
541
+
542
+ .uni-popper__arrow_bottom::after {
543
+ content: ' ';
544
+ top: 1px;
545
+ margin-left: -6px;
546
+ border-top-width: 0;
547
+ border-bottom-color: #fff;
548
+ }
549
+
550
+ .uni-popper__arrow_top {
551
+ filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
552
+ bottom: -6px;
553
+ left: 10%;
554
+ margin-right: 3px;
555
+ border-bottom-width: 0;
556
+ border-top-color: #ebeef5;
557
+ }
558
+
559
+ .uni-popper__arrow_top::after {
560
+ content: ' ';
561
+ bottom: 1px;
562
+ margin-left: -6px;
563
+ border-bottom-width: 0;
564
+ border-top-color: #fff;
565
+ }
566
+
567
+ .uni-select__input-text {
568
+ // width: 280px;
569
+ width: 100%;
570
+ color: $uni-main-color;
571
+ white-space: nowrap;
572
+ text-overflow: ellipsis;
573
+ -o-text-overflow: ellipsis;
574
+ overflow: hidden;
575
+ }
576
+
577
+ .uni-select__input-placeholder {
578
+ color: $uni-base-color;
579
+ font-size: 12px;
580
+ }
581
+
582
+ .uni-select--mask {
583
+ position: fixed;
584
+ top: 0;
585
+ bottom: 0;
586
+ right: 0;
587
+ left: 0;
588
+ z-index: 2;
589
+ }
590
+ </style>
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @desc 函数防抖
3
+ * @param func 目标函数
4
+ * @param wait 延迟执行毫秒数
5
+ * @param immediate true - 立即执行, false - 延迟执行
6
+ */
7
+ export const debounce = function(func, wait = 1000, immediate = true) {
8
+ let timer;
9
+ return function() {
10
+ let context = this,
11
+ args = arguments;
12
+ if (timer) clearTimeout(timer);
13
+ if (immediate) {
14
+ let callNow = !timer;
15
+ timer = setTimeout(() => {
16
+ timer = null;
17
+ }, wait);
18
+ if (callNow) func.apply(context, args);
19
+ } else {
20
+ timer = setTimeout(() => {
21
+ func.apply(context, args);
22
+ }, wait)
23
+ }
24
+ }
25
+ }
26
+ /**
27
+ * @desc 函数节流
28
+ * @param func 函数
29
+ * @param wait 延迟执行毫秒数
30
+ * @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发
31
+ */
32
+ export const throttle = (func, wait = 1000, type = 1) => {
33
+ let previous = 0;
34
+ let timeout;
35
+ return function() {
36
+ let context = this;
37
+ let args = arguments;
38
+ if (type === 1) {
39
+ let now = Date.now();
40
+
41
+ if (now - previous > wait) {
42
+ func.apply(context, args);
43
+ previous = now;
44
+ }
45
+ } else if (type === 2) {
46
+ if (!timeout) {
47
+ timeout = setTimeout(() => {
48
+ timeout = null;
49
+ func.apply(context, args)
50
+ }, wait)
51
+ }
52
+ }
53
+ }
54
+ }