uview-plus 3.1.50 → 3.1.52

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 (169) hide show
  1. package/README.md +10 -10
  2. package/changelog.md +18 -1
  3. package/components/u-action-sheet/props.js +10 -11
  4. package/components/u-album/props.js +11 -12
  5. package/components/u-alert/props.js +8 -9
  6. package/components/u-avatar/props.js +14 -15
  7. package/components/u-avatar-group/props.js +9 -10
  8. package/components/u-back-top/props.js +10 -11
  9. package/components/u-back-top/u-back-top.vue +1 -1
  10. package/components/u-badge/props.js +14 -15
  11. package/components/u-badge/u-badge.vue +1 -1
  12. package/components/u-button/props.js +28 -29
  13. package/components/u-button/u-button.vue +6 -6
  14. package/components/u-button/vue.scss +8 -7
  15. package/components/u-calendar/month.vue +1 -1
  16. package/components/u-calendar/props.js +27 -28
  17. package/components/u-car-keyboard/props.js +0 -1
  18. package/components/u-car-keyboard/u-car-keyboard.vue +1 -1
  19. package/components/u-cell/props.js +17 -18
  20. package/components/u-cell/u-cell.vue +14 -4
  21. package/components/u-cell-group/props.js +2 -3
  22. package/components/u-cell-group/u-cell-group.vue +1 -1
  23. package/components/u-checkbox/props.js +13 -14
  24. package/components/u-checkbox/u-checkbox.vue +1 -1
  25. package/components/u-checkbox-group/props.js +16 -17
  26. package/components/u-circle-progress/props.js +1 -2
  27. package/components/u-code/props.js +6 -7
  28. package/components/u-code/u-code.vue +5 -0
  29. package/components/u-code-input/props.js +16 -17
  30. package/components/u-col/props.js +5 -6
  31. package/components/u-collapse/props.js +3 -4
  32. package/components/u-collapse-item/props.js +11 -12
  33. package/components/u-column-notice/props.js +10 -11
  34. package/components/u-copy/u-copy.vue +70 -0
  35. package/components/u-count-down/props.js +4 -5
  36. package/components/u-count-down/u-count-down.vue +6 -1
  37. package/components/u-count-to/props.js +11 -12
  38. package/components/u-datetime-picker/props.js +37 -25
  39. package/components/u-datetime-picker/u-datetime-picker.vue +58 -3
  40. package/components/u-divider/props.js +8 -9
  41. package/components/u-dropdown/props.js +0 -1
  42. package/components/u-dropdown-item/props.js +0 -1
  43. package/components/u-empty/props.js +11 -12
  44. package/components/u-form/props.js +8 -9
  45. package/components/u-form/u-form.vue +1 -1
  46. package/components/u-form-item/props.js +13 -9
  47. package/components/u-form-item/u-form-item.vue +1 -0
  48. package/components/u-gap/props.js +4 -5
  49. package/components/u-gap/u-gap.vue +5 -4
  50. package/components/u-grid/props.js +3 -4
  51. package/components/u-grid-item/props.js +2 -3
  52. package/components/u-grid-item/u-grid-item.vue +5 -0
  53. package/components/u-icon/props.js +17 -18
  54. package/components/u-icon/u-icon.vue +9 -6
  55. package/components/u-image/props.js +16 -17
  56. package/components/u-image/u-image.vue +1 -1
  57. package/components/u-index-anchor/props.js +5 -6
  58. package/components/u-index-anchor/u-index-anchor.vue +1 -1
  59. package/components/u-index-item/props.js +0 -1
  60. package/components/u-index-item/u-index-item.vue +1 -1
  61. package/components/u-index-list/props.js +5 -6
  62. package/components/u-index-list/u-index-list.vue +3 -2
  63. package/components/u-input/props.js +35 -36
  64. package/components/u-input/u-input.vue +10 -4
  65. package/components/u-keyboard/props.js +16 -17
  66. package/components/u-line/props.js +6 -7
  67. package/components/u-line-progress/props.js +5 -6
  68. package/components/u-link/props.js +7 -8
  69. package/components/u-list/props.js +14 -15
  70. package/components/u-list-item/props.js +1 -2
  71. package/components/u-loading-icon/props.js +11 -12
  72. package/components/u-loading-page/props.js +9 -10
  73. package/components/u-loadmore/props.js +18 -19
  74. package/components/u-modal/props.js +16 -17
  75. package/components/u-navbar/props.js +16 -17
  76. package/components/u-no-network/props.js +3 -4
  77. package/components/u-notice-bar/props.js +13 -14
  78. package/components/u-notify/props.js +9 -10
  79. package/components/u-notify/u-notify.vue +5 -0
  80. package/components/u-number-box/props.js +22 -23
  81. package/components/u-number-box/u-number-box.vue +21 -1
  82. package/components/u-number-keyboard/props.js +3 -4
  83. package/components/u-overlay/props.js +4 -5
  84. package/components/u-parse/props.js +8 -9
  85. package/components/u-parse/u-parse.vue +6 -1
  86. package/components/u-picker/props.js +16 -17
  87. package/components/u-picker-column/props.js +0 -1
  88. package/components/u-popup/props.js +15 -16
  89. package/components/u-qrcode/qrcode.js +1206 -0
  90. package/components/u-qrcode/u-qrcode.vue +199 -0
  91. package/components/u-radio/props.js +13 -14
  92. package/components/u-radio-group/props.js +17 -18
  93. package/components/u-rate/props.js +14 -15
  94. package/components/u-read-more/props.js +8 -9
  95. package/components/u-row/props.js +3 -4
  96. package/components/u-row-notice/props.js +7 -8
  97. package/components/u-row-notice/u-row-notice.vue +5 -0
  98. package/components/u-safe-bottom/props.js +0 -1
  99. package/components/u-scroll-list/props.js +6 -7
  100. package/components/u-search/props.js +24 -25
  101. package/components/u-skeleton/props.js +11 -12
  102. package/components/u-slider/props.js +11 -12
  103. package/components/u-status-bar/props.js +1 -2
  104. package/components/u-status-bar/u-status-bar.vue +1 -1
  105. package/components/u-steps/props.js +7 -8
  106. package/components/u-steps/u-steps.vue +1 -1
  107. package/components/u-steps-item/props.js +4 -5
  108. package/components/u-steps-item/u-steps-item.vue +1 -1
  109. package/components/u-sticky/props.js +6 -7
  110. package/components/u-sticky/u-sticky.vue +5 -0
  111. package/components/u-subsection/props.js +9 -10
  112. package/components/u-subsection/u-subsection.vue +2 -2
  113. package/components/u-swipe-action/props.js +1 -2
  114. package/components/u-swipe-action-item/nvue.js +5 -0
  115. package/components/u-swipe-action-item/props.js +6 -7
  116. package/components/u-swiper/props.js +24 -25
  117. package/components/u-swiper-indicator/props.js +5 -6
  118. package/components/u-switch/props.js +11 -12
  119. package/components/u-tabbar/props.js +8 -9
  120. package/components/u-tabbar-item/props.js +6 -7
  121. package/components/u-table/props.js +0 -1
  122. package/components/u-tabs/props.js +12 -13
  123. package/components/u-tabs-item/props.js +0 -1
  124. package/components/u-tag/props.js +15 -16
  125. package/components/u-td/props.js +0 -1
  126. package/components/u-text/props.js +21 -22
  127. package/components/u-textarea/props.js +23 -24
  128. package/components/u-toast/u-toast.vue +5 -0
  129. package/components/u-toolbar/props.js +6 -7
  130. package/components/u-tooltip/props.js +11 -12
  131. package/components/u-tooltip/u-tooltip.vue +0 -28
  132. package/components/u-tr/props.js +0 -1
  133. package/components/u-transition/props.js +4 -5
  134. package/components/u-transition/transition.js +8 -9
  135. package/components/u-transition/u-transition.vue +1 -1
  136. package/components/u-upload/props.js +22 -23
  137. package/components/u-upload/u-upload.vue +1 -1
  138. package/index.js +6 -6
  139. package/libs/config/props/actionSheet.js +1 -1
  140. package/libs/config/props/album.js +1 -1
  141. package/libs/config/props/avatarGroup.js +1 -1
  142. package/libs/config/props/backtop.js +2 -2
  143. package/libs/config/props/badge.js +1 -1
  144. package/libs/config/props/calendar.js +3 -3
  145. package/libs/config/props/checkboxGroup.js +1 -1
  146. package/libs/config/props/datetimePicker.js +1 -1
  147. package/libs/config/props/form.js +3 -3
  148. package/libs/config/props/formItem.js +1 -0
  149. package/libs/config/props/indexList.js +1 -1
  150. package/libs/config/props/noticeBar.js +1 -1
  151. package/libs/config/props/picker.js +2 -2
  152. package/libs/config/props/popup.js +1 -1
  153. package/libs/config/props/search.js +2 -2
  154. package/libs/config/props/slider.js +1 -1
  155. package/libs/config/props/swiper.js +1 -1
  156. package/libs/config/props/tabs.js +7 -7
  157. package/libs/config/props/text.js +2 -2
  158. package/libs/config/props/toast.js +1 -1
  159. package/libs/config/props/tooltip.js +1 -1
  160. package/libs/config/props/upload.js +3 -3
  161. package/libs/css/components.scss +11 -1
  162. package/libs/css/flex.scss +103 -101
  163. package/libs/function/colorGradient.js +8 -8
  164. package/libs/function/debounce.js +2 -2
  165. package/libs/function/digit.js +5 -5
  166. package/libs/function/index.js +29 -29
  167. package/libs/function/test.js +28 -28
  168. package/libs/function/throttle.js +2 -2
  169. package/package.json +4 -3
@@ -85,40 +85,40 @@
85
85
 
86
86
  // 自动伸缩
87
87
  .u-flex-fill {
88
- flex: 1 1 auto
88
+ flex: 1 1 auto;
89
89
  }
90
90
 
91
91
  // 边界自动伸缩
92
92
  .u-margin-top-auto,
93
93
  .u-m-t-auto {
94
- margin-top: auto !important
94
+ margin-top: auto !important;
95
95
  }
96
96
 
97
97
  .u-margin-right-auto,
98
98
  .u-m-r-auto {
99
- margin-right: auto !important
99
+ margin-right: auto !important;
100
100
  }
101
101
 
102
102
  .u-margin-bottom-auto,
103
103
  .u-m-b-auto {
104
- margin-bottom: auto !important
104
+ margin-bottom: auto !important;
105
105
  }
106
106
 
107
107
  .u-margin-left-auto,
108
108
  .u-m-l-auto {
109
- margin-left: auto !important
109
+ margin-left: auto !important;
110
110
  }
111
111
 
112
112
  .u-margin-center-auto,
113
113
  .u-m-c-auto {
114
114
  margin-left: auto !important;
115
- margin-right: auto !important
115
+ margin-right: auto !important;
116
116
  }
117
117
 
118
118
  .u-margin-middle-auto,
119
119
  .u-m-m-auto {
120
120
  margin-top: auto !important;
121
- margin-bottom: auto !important
121
+ margin-bottom: auto !important;
122
122
  }
123
123
  /* #endif */
124
124
 
@@ -134,163 +134,165 @@
134
134
 
135
135
  // 主轴起点对齐
136
136
  .u-flex-start {
137
- justify-content: flex-start
137
+ justify-content: flex-start;
138
138
  }
139
139
 
140
140
  // 主轴中间对齐
141
141
  .u-flex-center {
142
- justify-content: center
142
+ justify-content: center;
143
143
  }
144
144
 
145
145
  // 主轴终点对齐
146
146
  .u-flex-end {
147
- justify-content: flex-end
147
+ justify-content: flex-end;
148
148
  }
149
149
 
150
150
  // 主轴等比间距
151
151
  .u-flex-between {
152
- justify-content: space-between
152
+ justify-content: space-between;
153
153
  }
154
154
 
155
155
  // 主轴均分间距
156
156
  .u-flex-around {
157
- justify-content: space-around
157
+ justify-content: space-around;
158
158
  }
159
159
 
160
160
  // 交叉轴起点对齐
161
161
  .u-flex-items-start {
162
- align-items: flex-start
162
+ align-items: flex-start;
163
163
  }
164
164
 
165
165
  // 交叉轴中间对齐
166
166
  .u-flex-items-center {
167
- align-items: center
167
+ align-items: center;
168
168
  }
169
169
 
170
170
  // 交叉轴终点对齐
171
171
  .u-flex-items-end {
172
- align-items: flex-end
172
+ align-items: flex-end;
173
173
  }
174
174
 
175
175
  // 交叉轴第一行文字基线对齐
176
176
  .u-flex-items-baseline {
177
- align-items: baseline
177
+ /* #ifndef APP-NVUE */
178
+ align-items: baseline;
179
+ /* #endif */
178
180
  }
179
181
 
180
182
  // 交叉轴方向拉伸对齐
181
183
  .u-flex-items-stretch {
182
- align-items: stretch
184
+ align-items: stretch;
183
185
  }
184
186
 
185
187
 
186
188
  // 以下属于项目(子元素)的类
187
189
 
188
190
  // 子元素交叉轴起点对齐
189
- .u-flex-self-start {
190
- align-self: flex-start
191
- }
191
+ // .u-flex-self-start {
192
+ // align-self: flex-start;
193
+ // }
192
194
 
193
- // 子元素交叉轴居中对齐
194
- .u-flex-self-center {
195
- align-self: center
196
- }
195
+ // // 子元素交叉轴居中对齐
196
+ // .u-flex-self-center {
197
+ // align-self: center;
198
+ // }
197
199
 
198
- // 子元素交叉轴终点对齐
199
- .u-flex-self-end {
200
- align-self: flex-end
201
- }
200
+ // // 子元素交叉轴终点对齐
201
+ // .u-flex-self-end {
202
+ // align-self: flex-end;
203
+ // }
202
204
 
203
205
  // 子元素交叉轴第一行文字基线对齐
204
- .u-flex-self-baseline {
205
- align-self: baseline
206
- }
206
+ // .u-flex-self-baseline {
207
+ // align-self: baseline;
208
+ // }
207
209
 
208
- // 子元素交叉轴方向拉伸对齐
209
- .u-flex-self-stretch {
210
- align-self: stretch
211
- }
210
+ // // 子元素交叉轴方向拉伸对齐
211
+ // .u-flex-self-stretch {
212
+ // align-self: stretch;
213
+ // }
212
214
 
213
215
  // 多轴交叉时的对齐方式
214
216
 
215
217
  // 起点对齐
216
- .u-flex-content-start {
217
- align-content: flex-start
218
- }
218
+ // .u-flex-content-start {
219
+ // align-content: flex-start;
220
+ // }
219
221
 
220
- // 居中对齐
221
- .u-flex-content-center {
222
- align-content: center
223
- }
222
+ // // 居中对齐
223
+ // .u-flex-content-center {
224
+ // align-content: center;
225
+ // }
224
226
 
225
- // 终点对齐
226
- .u-flex-content-end {
227
- align-content: flex-end
228
- }
227
+ // // 终点对齐
228
+ // .u-flex-content-end {
229
+ // align-content: flex-end;
230
+ // }
229
231
 
230
- // 两端对齐
231
- .u-flex-content-between {
232
- align-content: space-between
233
- }
232
+ // // 两端对齐
233
+ // .u-flex-content-between {
234
+ // align-content: space-between;
235
+ // }
234
236
 
235
- // 均分间距
236
- .u-flex-content-around {
237
- align-content: space-around
238
- }
237
+ // // 均分间距
238
+ // .u-flex-content-around {
239
+ // align-content: space-around;
240
+ // }
239
241
 
240
242
  // 全部居中对齐
241
243
  .u-flex-middle {
242
244
  justify-content: center;
243
245
  align-items: center;
244
- align-self: center;
245
- align-content: center
246
+ // align-self: center;
247
+ // align-content: center;
246
248
  }
247
249
 
248
250
  // 是否可以放大
249
- .u-flex-grow {
250
- flex-grow: 1
251
- }
251
+ // .u-flex-grow {
252
+ // flex-grow: 1;
253
+ // }
252
254
 
253
255
  // 是否可以缩小
254
- .u-flex-shrink {
255
- flex-shrink: 1
256
- }
256
+ // .u-flex-shrink {
257
+ // flex-shrink: 1;
258
+ // }
257
259
 
258
- // 定义内外边距,历遍1-80
259
- @for $i from 0 through 80 {
260
- // 只要双数和能被5除尽的数
261
- @if $i % 2 == 0 or $i % 5 == 0 {
262
- // 得出:u-margin-30或者u-m-30
263
- .u-margin-#{$i}, .u-m-#{$i} {
264
- margin: $i + rpx!important;
265
- }
266
-
267
- // 得出:u-padding-30或者u-p-30
268
- .u-padding-#{$i}, .u-p-#{$i} {
269
- padding: $i + rpx!important;
270
- }
271
-
272
- @each $short, $long in l left, t top, r right, b bottom {
273
- // 缩写版,结果如: u-m-l-30
274
- // 定义外边距
275
- .u-m-#{$short}-#{$i} {
276
- margin-#{$long}: $i + rpx!important;
277
- }
278
-
279
- // 定义内边距
280
- .u-p-#{$short}-#{$i} {
281
- padding-#{$long}: $i + rpx!important;
282
- }
283
-
284
- // 完整版,结果如:u-margin-left-30
285
- // 定义外边距
286
- .u-margin-#{$long}-#{$i} {
287
- margin-#{$long}: $i + rpx!important;
288
- }
289
-
290
- // 定义内边距
291
- .u-padding-#{$long}-#{$i} {
292
- padding-#{$long}: $i + rpx!important;
293
- }
294
- }
295
- }
296
- }
260
+ // 定义内外边距,历遍1-80
261
+ @for $i from 0 through 80 {
262
+ // 只要双数和能被5除尽的数
263
+ @if $i % 2 == 0 or $i % 5 == 0 {
264
+ // 得出:u-margin-30或者u-m-30
265
+ .u-margin-#{$i}, .u-m-#{$i} {
266
+ margin: $i + rpx!important;
267
+ }
268
+
269
+ // 得出:u-padding-30或者u-p-30
270
+ .u-padding-#{$i}, .u-p-#{$i} {
271
+ padding: $i + rpx!important;
272
+ }
273
+
274
+ @each $short, $long in l left, t top, r right, b bottom {
275
+ // 缩写版,结果如: u-m-l-30
276
+ // 定义外边距
277
+ .u-m-#{$short}-#{$i} {
278
+ margin-#{$long}: $i + rpx!important;
279
+ }
280
+
281
+ // 定义内边距
282
+ .u-p-#{$short}-#{$i} {
283
+ padding-#{$long}: $i + rpx!important;
284
+ }
285
+
286
+ // 完整版,结果如:u-margin-left-30
287
+ // 定义外边距
288
+ .u-margin-#{$long}-#{$i} {
289
+ margin-#{$long}: $i + rpx!important;
290
+ }
291
+
292
+ // 定义内边距
293
+ .u-padding-#{$long}-#{$i} {
294
+ padding-#{$long}: $i + rpx!important;
295
+ }
296
+ }
297
+ }
298
+ }
@@ -4,7 +4,7 @@
4
4
  * @param {string} endColor 结束的颜色
5
5
  * @param {number} step 颜色等分的份额
6
6
  * */
7
- function colorGradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 255)', step = 10) {
7
+ export function colorGradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 255)', step = 10) {
8
8
  const startRGB = hexToRgb(startColor, false) // 转换为rgb数组模式
9
9
  const startR = startRGB[0]
10
10
  const startG = startRGB[1]
@@ -33,7 +33,7 @@ function colorGradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 25
33
33
  }
34
34
 
35
35
  // 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
36
- function hexToRgb(sColor, str = true) {
36
+ export function hexToRgb(sColor, str = true) {
37
37
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
38
38
  sColor = String(sColor).toLowerCase()
39
39
  if (sColor && reg.test(sColor)) {
@@ -52,16 +52,16 @@ function hexToRgb(sColor, str = true) {
52
52
  if (!str) {
53
53
  return sColorChange
54
54
  }
55
- return `rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`
55
+ return `rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`
56
56
  } if (/^(rgb|RGB)/.test(sColor)) {
57
57
  const arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
58
58
  return arr.map((val) => Number(val))
59
59
  }
60
- return sColor
60
+ return sColor
61
61
  }
62
62
 
63
63
  // 将rgb表示方式转换为hex表示方式
64
- function rgbToHex(rgb) {
64
+ export function rgbToHex(rgb) {
65
65
  const _this = rgb
66
66
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
67
67
  if (/^(rgb|RGB)/.test(_this)) {
@@ -100,7 +100,7 @@ function rgbToHex(rgb) {
100
100
  * sHex为传入的十六进制的色值
101
101
  * alpha为rgba的透明度
102
102
  */
103
- function colorToRgba(color, alpha) {
103
+ export function colorToRgba(color, alpha) {
104
104
  color = rgbToHex(color)
105
105
  // 十六进制颜色值的正则表达式
106
106
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
@@ -123,7 +123,7 @@ function colorToRgba(color, alpha) {
123
123
  return `rgba(${sColorChange.join(',')},${alpha})`
124
124
  }
125
125
 
126
- return sColor
126
+ return sColor
127
127
  }
128
128
 
129
129
  export default {
@@ -131,4 +131,4 @@ export default {
131
131
  hexToRgb,
132
132
  rgbToHex,
133
133
  colorToRgba
134
- }
134
+ }
@@ -8,7 +8,7 @@ let timeout = null
8
8
  * @param {Boolean} immediate 是否立即执行
9
9
  * @return null
10
10
  */
11
- function debounce(func, wait = 500, immediate = false) {
11
+ export function debounce(func, wait = 500, immediate = false) {
12
12
  // 清除定时器
13
13
  if (timeout !== null) clearTimeout(timeout)
14
14
  // 立即执行,此类情况一般用不到
@@ -23,7 +23,7 @@ function debounce(func, wait = 500, immediate = false) {
23
23
  timeout = setTimeout(() => {
24
24
  typeof func === 'function' && func()
25
25
  }, wait)
26
- }
26
+ }
27
27
  }
28
28
 
29
29
  export default debounce
@@ -5,7 +5,7 @@ let _boundaryCheckingState = true; // 是否进行越界检查的全局开关
5
5
  * @private
6
6
  * @example strip(0.09999999999999998)=0.1
7
7
  */
8
- function strip(num, precision = 15) {
8
+ export function strip(num, precision = 15) {
9
9
  return +parseFloat(Number(num).toPrecision(precision));
10
10
  }
11
11
 
@@ -14,7 +14,7 @@ function strip(num, precision = 15) {
14
14
  * @private
15
15
  * @param {*number} num Input number
16
16
  */
17
- function digitLength(num) {
17
+ export function digitLength(num) {
18
18
  // Get digit length of e
19
19
  const eSplit = num.toString().split(/[eE]/);
20
20
  const len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0);
@@ -26,7 +26,7 @@ function digitLength(num) {
26
26
  * @private
27
27
  * @param {*number} num 输入数
28
28
  */
29
- function float2Fixed(num) {
29
+ export function float2Fixed(num) {
30
30
  if (num.toString().indexOf('e') === -1) {
31
31
  return Number(num.toString().replace('.', ''));
32
32
  }
@@ -39,7 +39,7 @@ function float2Fixed(num) {
39
39
  * @private
40
40
  * @param {*number} num 输入数
41
41
  */
42
- function checkBoundary(num) {
42
+ export function checkBoundary(num) {
43
43
  if (_boundaryCheckingState) {
44
44
  if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
45
45
  console.warn(`${num} 超出了精度限制,结果可能不正确`);
@@ -53,7 +53,7 @@ function checkBoundary(num) {
53
53
  * @param {function} operation 迭代操作
54
54
  * @private
55
55
  */
56
- function iteratorOperation(arr, operation) {
56
+ export function iteratorOperation(arr, operation) {
57
57
  const [num1, num2, ...others] = arr;
58
58
  let res = operation(num1, num2);
59
59
 
@@ -6,7 +6,7 @@ import { round } from './digit.js'
6
6
  * @param {number} max
7
7
  * @param {number} value
8
8
  */
9
- function range(min = 0, max = 0, value = 0) {
9
+ export function range(min = 0, max = 0, value = 0) {
10
10
  return Math.max(min, Math.min(max, Number(value)))
11
11
  }
12
12
 
@@ -16,7 +16,7 @@ function range(min = 0, max = 0, value = 0) {
16
16
  * @param {boolean} unit
17
17
  * @returns {number|string}
18
18
  */
19
- function getPx(value, unit = false) {
19
+ export function getPx(value, unit = false) {
20
20
  if (test.number(value)) {
21
21
  return unit ? `${value}px` : Number(value)
22
22
  }
@@ -32,7 +32,7 @@ function getPx(value, unit = false) {
32
32
  * @param {number} value 堵塞时间 单位ms 毫秒
33
33
  * @returns {Promise} 返回promise
34
34
  */
35
- function sleep(value = 30) {
35
+ export function sleep(value = 30) {
36
36
  return new Promise((resolve) => {
37
37
  setTimeout(() => {
38
38
  resolve()
@@ -44,14 +44,14 @@ function sleep(value = 30) {
44
44
  * @returns {string} 返回所在平台(小写)
45
45
  * @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
46
46
  */
47
- function os() {
47
+ export function os() {
48
48
  return uni.getSystemInfoSync().platform.toLowerCase()
49
49
  }
50
50
  /**
51
51
  * @description 获取系统信息同步接口
52
52
  * @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
53
53
  */
54
- function sys() {
54
+ export function sys() {
55
55
  return uni.getSystemInfoSync()
56
56
  }
57
57
 
@@ -60,7 +60,7 @@ function sys() {
60
60
  * @param {Number} min 最小值
61
61
  * @param {Number} max 最大值
62
62
  */
63
- function random(min, max) {
63
+ export function random(min, max) {
64
64
  if (min >= 0 && max > 0 && max >= min) {
65
65
  const gab = max - min + 1
66
66
  return Math.floor(Math.random() * gab + min)
@@ -73,7 +73,7 @@ function random(min, max) {
73
73
  * @param {Boolean} firstU 将返回的首字母置为"u"
74
74
  * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
75
75
  */
76
- function guid(len = 32, firstU = true, radix = null) {
76
+ export function guid(len = 32, firstU = true, radix = null) {
77
77
  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
78
78
  const uuid = []
79
79
  radix = radix || chars.length
@@ -109,7 +109,7 @@ function guid(len = 32, firstU = true, radix = null) {
109
109
  值(默认为undefined),就是查找最顶层的$parent
110
110
  * @param {string|undefined} name 父组件的参数名
111
111
  */
112
- function $parent(name = undefined) {
112
+ export function $parent(name = undefined) {
113
113
  let parent = this.$parent
114
114
  // 通过while历遍,这里主要是为了H5需要多层解析的问题
115
115
  while (parent) {
@@ -131,7 +131,7 @@ function $parent(name = undefined) {
131
131
  * @param {String} target 转换的目的,object-转为对象,string-转为字符串
132
132
  * @returns {object|string}
133
133
  */
134
- function addStyle(customStyle, target = 'object') {
134
+ export function addStyle(customStyle, target = 'object') {
135
135
  // 字符串转字符串,对象转对象情形,直接返回
136
136
  if (test.empty(customStyle) || typeof(customStyle) === 'object' && target === 'object' || target === 'string' &&
137
137
  typeof(customStyle) === 'string') {
@@ -170,7 +170,7 @@ function addStyle(customStyle, target = 'object') {
170
170
  * @param {string|number} value 需要添加单位的值
171
171
  * @param {string} unit 添加的单位名 比如px
172
172
  */
173
- function addUnit(value = 'auto', unit = '') {
173
+ export function addUnit(value = 'auto', unit = '') {
174
174
  if (!unit) {
175
175
  unit = uni.$u.config.unit || 'px'
176
176
  }
@@ -184,7 +184,7 @@ function addUnit(value = 'auto', unit = '') {
184
184
  * @param {object} obj 需要深度克隆的对象
185
185
  * @returns {*} 克隆后的对象或者原值(不是对象)
186
186
  */
187
- function deepClone(obj) {
187
+ export function deepClone(obj) {
188
188
  // 对常见的“非”值,直接返回原来值
189
189
  if ([null, undefined, NaN, false].includes(obj)) return obj
190
190
  if (typeof obj !== 'object' && typeof obj !== 'function') {
@@ -206,7 +206,7 @@ function deepClone(obj) {
206
206
  * @param {object} source 拷贝的来源对象
207
207
  * @returns {object|boolean} 深度合并后的对象或者false(入参有不是对象)
208
208
  */
209
- function deepMerge(target = {}, source = {}) {
209
+ export function deepMerge(target = {}, source = {}) {
210
210
  target = deepClone(target)
211
211
  if (typeof target !== 'object' || typeof source !== 'object') return false
212
212
  for (const prop in source) {
@@ -234,7 +234,7 @@ function deepMerge(target = {}, source = {}) {
234
234
  * @description error提示
235
235
  * @param {*} err 错误内容
236
236
  */
237
- function error(err) {
237
+ export function error(err) {
238
238
  // 开发环境才提示,生产环境不会提示
239
239
  if (process.env.NODE_ENV === 'development') {
240
240
  console.error(`uView提示:${err}`)
@@ -246,7 +246,7 @@ function error(err) {
246
246
  * @param {array} array 需要打乱的数组
247
247
  * @returns {array} 打乱后的数组
248
248
  */
249
- function randomArray(array = []) {
249
+ export function randomArray(array = []) {
250
250
  // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
251
251
  return array.sort(() => Math.random() - 0.5)
252
252
  }
@@ -283,7 +283,7 @@ if (!String.prototype.padStart) {
283
283
  * @param {String} fmt 格式化规则 yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 默认yyyy-mm-dd
284
284
  * @returns {string} 返回格式化后的字符串
285
285
  */
286
- function timeFormat(dateTime = null, formatStr = 'yyyy-mm-dd') {
286
+ export function timeFormat(dateTime = null, formatStr = 'yyyy-mm-dd') {
287
287
  let date
288
288
  // 若传入时间为假值,则取当前时间
289
289
  if (!dateTime) {
@@ -337,7 +337,7 @@ if (!String.prototype.padStart) {
337
337
  * 如果为布尔值false,无论什么时间,都返回多久以前的格式
338
338
  * @returns {string} 转化后的内容
339
339
  */
340
- function timeFrom(timestamp = null, format = 'yyyy-mm-dd') {
340
+ export function timeFrom(timestamp = null, format = 'yyyy-mm-dd') {
341
341
  if (timestamp == null) timestamp = Number(new Date())
342
342
  timestamp = parseInt(timestamp)
343
343
  // 判断用户输入的时间戳是秒还是毫秒,一般前端js获取的时间戳是毫秒(13位),后端传过来的为秒(10位)
@@ -379,7 +379,7 @@ function timeFrom(timestamp = null, format = 'yyyy-mm-dd') {
379
379
  * @param String str 需要去除空格的字符串
380
380
  * @param String pos both(左右)|left|right|all 默认both
381
381
  */
382
- function trim(str, pos = 'both') {
382
+ export function trim(str, pos = 'both') {
383
383
  str = String(str)
384
384
  if (pos == 'both') {
385
385
  return str.replace(/^\s+|\s+$/g, '')
@@ -402,7 +402,7 @@ function trim(str, pos = 'both') {
402
402
  * @param {Boolean} isPrefix,是否自动加上"?"
403
403
  * @param {string} arrayFormat 规则 indices|brackets|repeat|comma
404
404
  */
405
- function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
405
+ export function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
406
406
  const prefix = isPrefix ? '?' : ''
407
407
  const _result = []
408
408
  if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets'
@@ -459,7 +459,7 @@ function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
459
459
  * @param {String} title 提示的内容,长度与 icon 取值有关。
460
460
  * @param {Number} duration 提示的延迟时间,单位毫秒,默认:2000
461
461
  */
462
- function toast(title, duration = 2000) {
462
+ export function toast(title, duration = 2000) {
463
463
  uni.showToast({
464
464
  title: String(title),
465
465
  icon: 'none',
@@ -472,7 +472,7 @@ function toast(title, duration = 2000) {
472
472
  * @param {String} type 主题名称,primary|info|error|warning|success
473
473
  * @param {boolean} fill 是否使用fill填充实体的图标
474
474
  */
475
- function type2icon(type = 'success', fill = false) {
475
+ export function type2icon(type = 'success', fill = false) {
476
476
  // 如果非预置值,默认为success
477
477
  if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success'
478
478
  let iconName = ''
@@ -509,7 +509,7 @@ function type2icon(type = 'success', fill = false) {
509
509
  * @param {string} thousandsSeparator 千分位符号
510
510
  * @returns {string} 格式化后的数字
511
511
  */
512
- function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') {
512
+ export function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') {
513
513
  number = (`${number}`).replace(/[^0-9+-Ee.]/g, '')
514
514
  const n = !isFinite(+number) ? 0 : +number
515
515
  const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
@@ -538,7 +538,7 @@ function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparato
538
538
  * @param {boolean} unit 提示: 如果是false 默认返回number
539
539
  * @return {string|number}
540
540
  */
541
- function getDuration(value, unit = true) {
541
+ export function getDuration(value, unit = true) {
542
542
  const valueNum = parseInt(value)
543
543
  if (unit) {
544
544
  if (/s$/.test(value)) return value
@@ -553,7 +553,7 @@ function getDuration(value, unit = true) {
553
553
  * @description 日期的月或日补零操作
554
554
  * @param {String} value 需要补零的值
555
555
  */
556
- function padZero(value) {
556
+ export function padZero(value) {
557
557
  return `00${value}`.slice(-2)
558
558
  }
559
559
 
@@ -562,7 +562,7 @@ function padZero(value) {
562
562
  * @param {*} instance
563
563
  * @param {*} event
564
564
  */
565
- function formValidate(instance, event) {
565
+ export function formValidate(instance, event) {
566
566
  const formItem = uni.$u.$parent.call(instance, 'u-form-item')
567
567
  const form = uni.$u.$parent.call(instance, 'u-form')
568
568
  // 如果发生变化的input或者textarea等,其父组件中有u-form-item或者u-form等,就执行form的validate方法
@@ -578,7 +578,7 @@ function formValidate(instance, event) {
578
578
  * @param {string} key 需要获取的属性字段
579
579
  * @returns {*}
580
580
  */
581
- function getProperty(obj, key) {
581
+ export function getProperty(obj, key) {
582
582
  if (!obj) {
583
583
  return
584
584
  }
@@ -605,7 +605,7 @@ function getProperty(obj, key) {
605
605
  * @param {string} key 需要设置的属性
606
606
  * @param {string} value 设置的值
607
607
  */
608
- function setProperty(obj, key, value) {
608
+ export function setProperty(obj, key, value) {
609
609
  if (!obj) {
610
610
  return
611
611
  }
@@ -641,7 +641,7 @@ function setProperty(obj, key, value) {
641
641
  /**
642
642
  * @description 获取当前页面路径
643
643
  */
644
- function page() {
644
+ export function page() {
645
645
  const pages = getCurrentPages()
646
646
  // 某些特殊情况下(比如页面进行redirectTo时的一些时机),pages可能为空数组
647
647
  return `/${pages[pages.length - 1].route || ''}`
@@ -650,7 +650,7 @@ function page() {
650
650
  /**
651
651
  * @description 获取当前路由栈实例数组
652
652
  */
653
- function pages() {
653
+ export function pages() {
654
654
  const pages = getCurrentPages()
655
655
  return pages
656
656
  }
@@ -662,7 +662,7 @@ function pages() {
662
662
  * @param {object} color 修改内置color属性
663
663
  * @param {object} zIndex 修改内置zIndex属性
664
664
  */
665
- function setConfig({
665
+ export function setConfig({
666
666
  props = {},
667
667
  config = {},
668
668
  color = {},