uview-plus 3.6.29 → 3.7.13

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 (124) hide show
  1. package/README.md +20 -5
  2. package/changelog.md +352 -0
  3. package/components/u-action-sheet/actionSheet.js +2 -0
  4. package/components/u-action-sheet/props.js +10 -0
  5. package/components/u-action-sheet/u-action-sheet.vue +3 -3
  6. package/components/u-album/album.js +1 -1
  7. package/components/u-avatar/avatar.js +4 -4
  8. package/components/u-avatar-group/avatarGroup.js +4 -4
  9. package/components/u-back-top/backtop.js +4 -4
  10. package/components/u-badge/badge.js +4 -4
  11. package/components/u-box/box.js +24 -0
  12. package/components/u-box/props.js +37 -7
  13. package/components/u-box/u-box.vue +29 -14
  14. package/components/u-button/button.js +4 -4
  15. package/components/u-calendar/calendar.js +4 -4
  16. package/components/u-canvas/u-canvas.vue +423 -0
  17. package/components/u-car-keyboard/carKeyboard.js +4 -4
  18. package/components/u-cascader/u-cascader.vue +19 -10
  19. package/components/u-cate-tab/u-cate-tab.vue +14 -4
  20. package/components/u-cell/cell.js +4 -4
  21. package/components/u-cell-group/cellGroup.js +4 -4
  22. package/components/u-checkbox/checkbox.js +4 -4
  23. package/components/u-checkbox-group/checkboxGroup.js +4 -4
  24. package/components/u-checkbox-group/u-checkbox-group.vue +4 -1
  25. package/components/u-circle-progress/circleProgress.js +4 -4
  26. package/components/u-code/code.js +3 -3
  27. package/components/u-code-input/codeInput.js +4 -4
  28. package/components/u-col/col.js +4 -4
  29. package/components/u-collapse/collapse.js +4 -4
  30. package/components/u-collapse-item/collapseItem.js +4 -4
  31. package/components/u-column-notice/columnNotice.js +4 -4
  32. package/components/u-count-down/countDown.js +4 -4
  33. package/components/u-count-to/countTo.js +4 -4
  34. package/components/u-cropper/u-cropper.vue +6 -3
  35. package/components/u-datetime-picker/datetimePicker.js +4 -4
  36. package/components/u-divider/divider.js +4 -4
  37. package/components/u-dragsort/u-dragsort.vue +85 -72
  38. package/components/u-empty/empty.js +4 -4
  39. package/components/u-form/form.js +4 -4
  40. package/components/u-form-item/formItem.js +4 -4
  41. package/components/u-gap/gap.js +4 -4
  42. package/components/u-grid/grid.js +4 -4
  43. package/components/u-grid/u-grid.vue +1 -1
  44. package/components/u-grid-item/gridItem.js +4 -4
  45. package/components/u-icon/icon.js +4 -4
  46. package/components/u-image/image.js +4 -4
  47. package/components/u-index-anchor/indexAnchor.js +4 -4
  48. package/components/u-index-list/indexList.js +4 -4
  49. package/components/u-input/input.js +1 -1
  50. package/components/u-input/u-input.vue +5 -2
  51. package/components/u-keyboard/keyboard.js +4 -4
  52. package/components/u-line/line.js +4 -4
  53. package/components/u-line-progress/lineProgress.js +4 -4
  54. package/components/u-link/link.js +4 -4
  55. package/components/u-list/list.js +4 -4
  56. package/components/u-list/u-list.vue +4 -1
  57. package/components/u-list-item/listItem.js +4 -4
  58. package/components/u-loading-icon/loadingIcon.js +4 -4
  59. package/components/u-loading-page/loadingPage.js +4 -4
  60. package/components/u-loadmore/loadmore.js +4 -4
  61. package/components/u-modal/modal.js +5 -5
  62. package/components/u-navbar/navbar.js +4 -4
  63. package/components/u-no-network/noNetwork.js +4 -4
  64. package/components/u-no-network/u-no-network.vue +7 -3
  65. package/components/u-notice-bar/noticeBar.js +4 -4
  66. package/components/u-notify/notify.js +4 -4
  67. package/components/u-number-box/numberBox.js +4 -4
  68. package/components/u-number-keyboard/numberKeyboard.js +4 -4
  69. package/components/u-overlay/overlay.js +4 -4
  70. package/components/u-parse/props.js +1 -1
  71. package/components/u-picker/picker.js +4 -4
  72. package/components/u-picker/props.js +4 -0
  73. package/components/u-picker/u-picker.vue +1 -1
  74. package/components/u-popup/popup.js +4 -4
  75. package/components/u-qrcode/qrcode.js +17 -67
  76. package/components/u-qrcode/u-qrcode.vue +179 -86
  77. package/components/u-radio/radio.js +4 -4
  78. package/components/u-radio-group/radioGroup.js +3 -3
  79. package/components/u-rate/rate.js +4 -4
  80. package/components/u-read-more/readMore.js +4 -4
  81. package/components/u-row/row.js +4 -4
  82. package/components/u-row-notice/rowNotice.js +4 -4
  83. package/components/u-scroll-list/scrollList.js +4 -4
  84. package/components/u-search/search.js +7 -5
  85. package/components/u-search/u-search.vue +2 -2
  86. package/components/u-section/section.js +4 -4
  87. package/components/u-select/u-select.vue +7 -1
  88. package/components/u-signature/u-signature.vue +138 -137
  89. package/components/u-skeleton/skeleton.js +4 -4
  90. package/components/u-slider/props.js +17 -2
  91. package/components/u-slider/slider.js +10 -7
  92. package/components/u-slider/u-slider.vue +112 -35
  93. package/components/u-status-bar/statusBar.js +4 -4
  94. package/components/u-steps/steps.js +4 -4
  95. package/components/u-steps/u-steps.vue +1 -1
  96. package/components/u-steps-item/stepsItem.js +4 -4
  97. package/components/u-sticky/sticky.js +4 -4
  98. package/components/u-subsection/subsection.js +4 -4
  99. package/components/u-swipe-action/swipeAction.js +4 -4
  100. package/components/u-swipe-action-item/swipeActionItem.js +4 -4
  101. package/components/u-swiper/swiper.js +4 -4
  102. package/components/u-swiper-indicator/swipterIndicator.js +4 -4
  103. package/components/u-switch/switch.js +4 -4
  104. package/components/u-tabbar/tabbar.js +4 -4
  105. package/components/u-tabbar-item/tabbarItem.js +4 -4
  106. package/components/u-tabs/tabs.js +4 -4
  107. package/components/u-tabs/u-tabs.vue +83 -95
  108. package/components/u-tag/tag.js +4 -4
  109. package/components/u-text/text.js +4 -4
  110. package/components/u-textarea/textarea.js +4 -4
  111. package/components/u-toast/toast.js +4 -4
  112. package/components/u-toolbar/toolbar.js +4 -4
  113. package/components/u-tooltip/tooltip.js +4 -4
  114. package/components/u-transition/transition.js +4 -4
  115. package/components/u-upload/upload.js +4 -4
  116. package/libs/css/flex.scss +2 -1
  117. package/libs/function/index.js +9 -4
  118. package/libs/util/gcanvas/bridge/bridge-weex.js +2 -1
  119. package/libs/util/gcanvas/env/image.js +24 -16
  120. package/package.json +2 -4
  121. package/types/comps/radio.d.ts +6 -2
  122. package/types/func.d.ts +317 -0
  123. package/types/index.d.ts +73 -105
  124. package/components/u-scroll-list/other.js +0 -0
@@ -0,0 +1,317 @@
1
+ export interface RouteParam {
2
+ type: "navigateTo" | "redirect" | "switchTab" | "reLaunch" | "navigateBack";
3
+ /** 路由地址 */
4
+ url: string;
5
+ /** navigateBack页面后退时,回退的层数 */
6
+ delta?: number;
7
+ /** 传递的参数 */
8
+ params?: {};
9
+ /** 窗口动画,只在APP有效 */
10
+ animationType?: string;
11
+ /** 窗口动画持续时间,单位毫秒,只在APP有效 */
12
+ animationDuration?: number;
13
+ /** 是否需要拦截 */
14
+ intercept?: boolean;
15
+ }
16
+
17
+ export interface test {
18
+ /** 邮箱格式校验 */
19
+ email(email: string): boolean;
20
+ /** 手机号校验 */
21
+ mobile(phone: number): boolean;
22
+ /** url路径验证 */
23
+ url(value: string): boolean;
24
+ /** 验证日期格式 */
25
+ date(value: string | number): boolean;
26
+ /** 验证ISO类型的日期格式 YYYY-MM-DD | YYYY/MM/DD */
27
+ dateISO(value: string): boolean;
28
+ /** 验证十进制数字 */
29
+ number(value: number): boolean;
30
+ /** 验证字符串 */
31
+ string(value: string): boolean;
32
+ /** 验证整数 */
33
+ digits(value: number): boolean;
34
+ /** 验证身份证号码 */
35
+ idCard(value: string | number): boolean;
36
+ /** 是否车牌号 */
37
+ carNo(value: string): boolean;
38
+ /** 金额,只允许2位小数 */
39
+ amount(value: string | number): boolean;
40
+ /** 校验是否是中文 */
41
+ chinese(value: any): boolean;
42
+ /** 校验是否是字母 */
43
+ letter(value: any): boolean;
44
+ /** 校验字母或者数字 */
45
+ enOrNum(value: any): boolean;
46
+ /** 验证是否包含某个值 */
47
+ contains(source: string, value: string): boolean;
48
+ /** 验证一个值范围[min, max] */
49
+ range(value: string, between: number[]): boolean;
50
+ /** 验证一个长度范围[min, max] */
51
+ rangeLength(value: string, between: number[]): boolean;
52
+ /** 是否固定电话 */
53
+ landline(value: string | number): boolean;
54
+ /** 判断是否为空 */
55
+ empty(value: string | number | undefined | boolean | object | null): boolean;
56
+ /** 是否json字符串 */
57
+ jsonString(value: string): boolean;
58
+ /** 是否数组 */
59
+ array(value: any): boolean;
60
+ /** 是否对象 */
61
+ object(value: any): boolean;
62
+ /** 是否短信验证码 */
63
+ code(value: any, len: number): boolean;
64
+ /** 是否函数方法 */
65
+ func(value: any): boolean;
66
+ /** 是否promise对象 */
67
+ promise(value: any): boolean;
68
+ /** 是否图片格式 */
69
+ image(value: string): boolean;
70
+ /** 是否视频格式 */
71
+ video(value: string): boolean;
72
+ /** 是否为正则对象 */
73
+ regExp(value: any): boolean;
74
+ }
75
+
76
+ export interface Func {
77
+ /**
78
+ * 此方法用于限制value的大小
79
+ * - 如果其在min和max之间,则不变;
80
+ * - 如果其小于min,则取min值;
81
+ * - 如果其大于max,则取max值。
82
+ * @param min 最小值,默认 0
83
+ * @param max 最大值,默认 0
84
+ * @param value 当前值,默认 0
85
+ */
86
+ range(min?: number, max?: number, value?: number): number;
87
+
88
+ /**
89
+ * 用于获取用户传递值的px值
90
+ * - 如果用户传递了number,直接返回
91
+ * - 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分
92
+ * - 如果是"xxxrpx"还需要用过uni.rpx2px进行转换
93
+ * @param value 数值或带单位的字符串
94
+ * @param unit 是否返回带 px 的字符串
95
+ */
96
+ getPx(value: number | string, unit?: boolean): number | string;
97
+
98
+ /**
99
+ * 用于统一rpx2px方法,因uni-app现有API未统一。
100
+ * @param value rpx 值
101
+ */
102
+ rpx2px(value: number): number;
103
+
104
+ /**
105
+ * 进行延时,以达到可以简写代码的目的 比如: await uni.$u.sleep(20)将会阻塞20ms
106
+ * @param value 延时时间(ms),默认 30
107
+ */
108
+ sleep(value?: number): Promise<void>;
109
+
110
+ /**
111
+ * 运行期判断平台
112
+ * @returns 平台名称(小写)
113
+ * @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
114
+ */
115
+ os(): string;
116
+
117
+ /**
118
+ * 获取系统信息(同步)
119
+ * @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
120
+ */
121
+ sys(): UniApp.GetSystemInfoResult;
122
+
123
+ /**
124
+ * 获取一个区间内的随机整数
125
+ * @param min 最小值
126
+ * @param max 最大值
127
+ */
128
+ random(min: number, max: number): number;
129
+
130
+ /**
131
+ * 生成 uuid
132
+ * @param len uuid 长度,默认 32
133
+ * @param firstU 是否以 u 开头,默认 true
134
+ * @param radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
135
+ */
136
+ guid(len?: number, firstU?: boolean, radix?: number | null): string;
137
+
138
+ /**
139
+ * 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
140
+ * this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
141
+ * 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
142
+ * 值(默认为undefined),就是查找最顶层的$parent
143
+ * @param name 父组件 name
144
+ */
145
+ $parent(this: any, name?: string): any | false;
146
+
147
+ /**
148
+ * 样式转换
149
+ * - string → object
150
+ * - object → string
151
+ * @param customStyle 样式字符串或对象
152
+ * @param target 转换的目的,object-转为对象,string-转为字符串
153
+ */
154
+ addStyle(
155
+ customStyle: Record<string, any> | string,
156
+ target?: "object" | "string"
157
+ ): Record<string, any> | string;
158
+
159
+ /**
160
+ * 添加单位,如果有rpx,upx,%,px等单位结尾或者值为auto,直接返回,否则加上px单位结尾
161
+ * @param value 值(数字 / auto / 字符串)
162
+ * @param unit 单位,默认使用 config.unit
163
+ */
164
+ addUnit(value?: string | number, unit?: string): string;
165
+
166
+ /**
167
+ * 深度克隆
168
+ * @param obj 需要深度克隆的对象
169
+ */
170
+ deepClone<T extends object>(obj: T): T;
171
+
172
+ /**
173
+ * 深度合并对象
174
+ * @param target 需要拷贝的对象
175
+ * @param source 拷贝的来源对象
176
+ * @returns {object|boolean} 深度合并后的对象或者false(入参有不是对象)
177
+ */
178
+ deepMerge<T extends object, U extends object>(
179
+ target: T,
180
+ source: U
181
+ ): (T & U) | false;
182
+
183
+ /**
184
+ * JS对象深度合并
185
+ * @param {object} target 需要拷贝的对象
186
+ * @param {object} source 拷贝的来源对象
187
+ * @returns {object|boolean} 深度合并后的对象或者false(入参有不是对象)
188
+ */
189
+ shallowMerge<T extends object, U extends object>(
190
+ target: T,
191
+ source: U
192
+ ): (T & U) | false;
193
+
194
+ /**
195
+ * 打乱数组
196
+ * @param array 原数组
197
+ */
198
+ randomArray<T>(array: T[]): T[];
199
+
200
+ /**
201
+ * 时间格式化
202
+ * @param dateTime 时间戳 / 字符串
203
+ * @param formatStr fmt 格式化规则 yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 默认yyyy-mm-dd
204
+ */
205
+ timeFormat(dateTime?: string | number | null, formatStr?: string): string;
206
+
207
+ /**
208
+ * 时间转“多久之前”
209
+ * @param timestamp 时间戳
210
+ * @param format 格式化规则如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;如果为布尔值false,无论什么时间,都返回多久以前的格式
211
+ */
212
+ timeFrom(timestamp?: string | number | null, format?: string | false): string;
213
+
214
+ /**
215
+ * 去除空格
216
+ * @param str 原字符串
217
+ * @param pos 去除位置
218
+ */
219
+ trim(str: string, pos?: "both" | "left" | "right" | "all"): string;
220
+
221
+ /**
222
+ * 对象转 URL 参数
223
+ * @param data 参数对象
224
+ * @param isPrefix 是否自动加上"?"
225
+ * @param arrayFormat 数组格式
226
+ */
227
+ queryParams(
228
+ data?: Record<string, any>,
229
+ isPrefix?: boolean,
230
+ arrayFormat?: "indices" | "brackets" | "repeat" | "comma"
231
+ ): string;
232
+
233
+ /**
234
+ * 显示消息提示框
235
+ * @param title 提示内容
236
+ * @param duration 持续时间
237
+ */
238
+ toast(title: string, duration?: number): void;
239
+
240
+ /**
241
+ * 数字格式化
242
+ * @param number 要格式化的数字
243
+ * @param decimals 保留几位小数
244
+ * @param decimalPoint 小数点符号
245
+ * @param thousandsSeparator 千分位符号
246
+ * @returns 格式化后的数字
247
+ */
248
+ priceFormat(
249
+ number: string | number,
250
+ decimals?: number,
251
+ decimalPoint?: string,
252
+ thousandsSeparator?: string
253
+ ): string;
254
+
255
+ /**
256
+ * 生成同色系浅色背景
257
+ * @param textColor 文本颜色
258
+ * @param lightness 亮度百分比
259
+ */
260
+ genLightColor(textColor: string, lightness?: number): string;
261
+
262
+ /**
263
+ * 防抖函数
264
+ * @param func 触发回调执行的函数
265
+ * @param wait 时间间隔,单位ms
266
+ * @param immediate 在开始还是结束处触发,如非特殊情况,一般默认为false即可
267
+ */
268
+ debounce(
269
+ func: (...rest: any[]) => any,
270
+ wait?: number,
271
+ immediate?: boolean
272
+ ): void;
273
+
274
+ /**
275
+ * 节流函数
276
+ * @param func 触发回调执行的函数
277
+ * @param wait 时间间隔,单位ms
278
+ * @param immediate 在开始还是结束处触发,如非特殊情况,一般默认为false即可
279
+ */
280
+ throttle(
281
+ func: (...rest: any[]) => any,
282
+ wait?: number,
283
+ immediate?: boolean
284
+ ): void;
285
+
286
+ /**
287
+ * 求两个颜色之间的渐变值
288
+ * @param {string} startColor 开始的颜色
289
+ * @param {string} endColor 结束的颜色
290
+ * @param {number} step 颜色等分的份额
291
+ */
292
+ colorGradient(startColor: string, endColor: string, step: number): any[];
293
+
294
+ /**
295
+ * 将hex表示方式转换为rgb
296
+ * @param color "#000000"-> "rgb(0,0,0)" | "rgb(0,0,0)" -> "#000000"
297
+ * @param str 是否返回颜色数组 true -> 不返回
298
+ * @returns
299
+ */
300
+ hexToRgb(color: string, str?: boolean): any[];
301
+
302
+ /**
303
+ * 将rgb表示方式转换为hex
304
+ */
305
+ rgbToHex(color: string): string;
306
+
307
+ /**
308
+ * 十六进制转换为rgb或rgba
309
+ * @param color
310
+ * @param alpha 透明度
311
+ * @returns rgba(255,255,255,0.5)字符串
312
+ */
313
+ colorToRgba(color: string, alpha: number): string;
314
+
315
+ /** 路由跳转 */
316
+ route(url: string | RouteParam): void;
317
+ }
package/types/index.d.ts CHANGED
@@ -1,84 +1,51 @@
1
1
  /// <reference path="./comps.d.ts" />
2
+ type Func = import('./func').Func
2
3
  declare module 'uview-plus' {
3
- export function install(): void //必要
4
- interface test {
5
- /** 邮箱格式校验 */
6
- email(email: string): boolean
7
- /** 手机号校验 */
8
- mobile(phone: number): boolean;
9
- /** url路径验证 */
10
- url(value: string): boolean;
11
- /** 验证日期格式 */
12
- date(value: string | number): boolean;
13
- /** 验证ISO类型的日期格式 YYYY-MM-DD | YYYY/MM/DD */
14
- dateISO(value: string): boolean;
15
- /** 验证十进制数字 */
16
- number(value: number): boolean;
17
- /** 验证字符串 */
18
- string(value: string): boolean;
19
- /** 验证整数 */
20
- digits(value: number): boolean;
21
- /** 验证身份证号码 */
22
- idCard(value: string | number): boolean;
23
- /** 是否车牌号 */
24
- carNo(value: string): boolean;
25
- /** 金额,只允许2位小数 */
26
- amount(value: string | number): boolean;
27
- /** 校验是否是中文 */
28
- chinese(value: any): boolean;
29
- /** 校验是否是字母 */
30
- letter(value: any): boolean;
31
- /** 校验字母或者数字 */
32
- enOrNum(value: any): boolean;
33
- /** 验证是否包含某个值 */
34
- contains(source: string, value: string): boolean;
35
- /** 验证一个值范围[min, max] */
36
- range(value: string, between: number[]): boolean;
37
- /** 验证一个长度范围[min, max] */
38
- rangeLength(value: string, between: number[]): boolean;
39
- /** 是否固定电话 */
40
- landline(value: string | number): boolean;
41
- /** 判断是否为空 */
42
- empty(value: string | number | undefined | boolean | object | null): boolean;
43
- /** 是否json字符串 */
44
- jsonString(value: string): boolean;
45
- /** 是否数组 */
46
- array(value: any): boolean;
47
- /** 是否对象 */
48
- object(value: any): boolean;
49
- /** 是否短信验证码 */
50
- code(value: any, len: number): boolean;
51
- /** 是否函数方法 */
52
- func(value: any): boolean;
53
- /** 是否promise对象 */
54
- promise(value: any): boolean;
55
- /** 是否图片格式 */
56
- image(value: string): boolean;
57
- /** 是否视频格式 */
58
- video(value: string): boolean;
59
- /** 是否为正则对象 */
60
- regExp(value: any): boolean;
61
- }
62
- interface RouteParam {
63
- type: 'navigateTo' | 'redirect' | 'switchTab' | 'reLaunch' | 'navigateBack';
64
- /** 路由地址 */
65
- url: string;
66
- /** navigateBack页面后退时,回退的层数 */
67
- delta?: number;
68
- /** 传递的参数 */
69
- params?: {};
70
- /** 窗口动画,只在APP有效 */
71
- animationType?: string;
72
- /** 窗口动画持续时间,单位毫秒,只在APP有效 */
73
- animationDuration?: number;
74
- /** 是否需要拦截 */
75
- intercept?: boolean;
76
- }
4
+ export function install(
5
+ vm: import('vue').App,
6
+ upuiParams?: () => {
7
+ httpIns?: (http: HttpRequest) => void;
8
+ options?: Partial<GlobalConfig>;
9
+ }
10
+ ): void; //必要
11
+ type test = import('./func').test
12
+ type RouteParam = import('./func').RouteParam
13
+ type HttpRequest = InstanceType<typeof import('../libs/luch-request')['default']>
77
14
  interface Config {
78
15
  v: string;
79
16
  version: string;
80
17
  color: Partial<Color>;
81
- unit: 'px' | 'rpx'
18
+ /**
19
+ * - 修改默认单位,相当于执行 uni.$u.config.unit = 'rpx'
20
+ * - 组件的很多单位仍然为px并非配置不生效,而是rpx配置目前无法做到修改Vue单文件组件中的Css/Sass中写死的px单位。
21
+ * - 这个配置主要用于prop传参时的单位修改,比如<up-image width="80"></up-image>中的80会是rpx单位。
22
+ * - 如果需要全局组件样式变为rpx,可以尝试使用postcss等第三方插件转换。
23
+ * @default 'px'
24
+ */
25
+ unit: 'px' | 'rpx';
26
+ /**
27
+ * 只加载一次字体图标
28
+ * @default false
29
+ */
30
+ loadFontOnce: boolean;
31
+ /**
32
+ * 扩充自定义字体图标
33
+ * @version 3.4.14
34
+ */
35
+ customIcon: {
36
+ /** 字体族名称 */
37
+ family: string;
38
+ /** ttf文件远程链接 */
39
+ url: string;
40
+ };
41
+ /**
42
+ * unicode映射表,为了更直观书写,语义更明确
43
+ * - 如'light-mode': '\ue66c'
44
+ * - <up-icon customPrefix="xyicon" name="light-mode"></up-icon>
45
+ */
46
+ customIcons: {
47
+ [key: string]: string
48
+ }
82
49
  }
83
50
  interface Color {
84
51
  primary: string,
@@ -97,36 +64,10 @@ declare module 'uview-plus' {
97
64
  config: Partial<Config>;
98
65
  props: {};
99
66
  }
100
- interface $u {
101
- route: (url: string | RouteParam) => void;
102
- /**
103
- * 求两个颜色之间的渐变值
104
- * @param {string} startColor 开始的颜色
105
- * @param {string} endColor 结束的颜色
106
- * @param {number} step 颜色等分的份额
107
- */
108
- colorGradient: (startColor: string, endColor: string, step: number) => any[];
109
- /**
110
- * 将hex表示方式转换为rgb
111
- * @param color "#000000"-> "rgb(0,0,0)" | "rgb(0,0,0)" -> "#000000"
112
- * @param str 是否返回颜色数组 true -> 不返回
113
- * @returns
114
- */
115
- hexToRgb: (color: string, str?: boolean) => any[];
116
- /**
117
- * 将rgb表示方式转换为hex
118
- */
119
- rgbToHex: (color: string) => string;
120
- /**
121
- * 十六进制转换为rgb或rgba
122
- * @param color
123
- * @param alpha 透明度
124
- * @returns rgba(255,255,255,0.5)字符串
125
- */
126
- colorToRgba: (color: string, alpha: number) => string;
67
+ interface $u extends Func {
127
68
  test: test;
128
69
  type: {},
129
- http: {},
70
+ http: HttpRequest,
130
71
  config: Config;
131
72
  zIndex: {
132
73
  toast: number;
@@ -139,8 +80,6 @@ declare module 'uview-plus' {
139
80
  sticky: number;
140
81
  indexListSticky: number;
141
82
  },
142
- debounce: (func, wait, immediate) => void;
143
- throttle: (func, wait, immediate) => void;
144
83
  mixin: {},
145
84
  mpMixin: {},
146
85
  props: {},
@@ -149,6 +88,35 @@ declare module 'uview-plus' {
149
88
  }
150
89
 
151
90
  export function setConfig(config: Partial<GlobalConfig>): void;
91
+ // 可单独导入使用,也可以在 uni.$u 中使用
92
+ export const test: $u['test']
93
+ export const http: $u['http']
94
+ export const config: $u['config']
95
+ export const platform: $u['platform']
96
+ export const range: $u['range']
97
+ export const getPx: $u['getPx']
98
+ export const rpx2px: $u['rpx2px']
99
+ export const sleep: $u['sleep']
100
+ export const os: $u['os']
101
+ export const sys: $u['sys']
102
+ export const random: $u['random']
103
+ export const guid: $u['guid']
104
+ export const addStyle: $u['addStyle']
105
+ export const addUnit: $u['addUnit']
106
+ export const timeFormat: $u['timeFormat']
107
+ export const timeFrom: $u['timeFrom']
108
+ export const trim: $u['trim']
109
+ export const queryParams: $u['queryParams']
110
+ export const toast: $u['toast']
111
+ export const priceFormat: $u['priceFormat']
112
+ export const genLightColor: $u['genLightColor']
113
+ export const debounce: $u['debounce']
114
+ export const throttle: $u['throttle']
115
+ export const colorGradient: $u['colorGradient']
116
+ export const hexToRgb: $u['hexToRgb']
117
+ export const rgbToHex: $u['rgbToHex']
118
+ export const colorToRgba: $u['colorToRgba']
119
+ export const route: $u['route']
152
120
 
153
121
  global {
154
122
  interface Uni {
File without changes