uview-pro 0.2.3 → 0.3.0

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 (184) hide show
  1. package/changelog.md +52 -0
  2. package/components/u-action-sheet/types.ts +2 -0
  3. package/components/u-action-sheet/u-action-sheet.vue +25 -7
  4. package/components/u-alert-tips/types.ts +2 -0
  5. package/components/u-alert-tips/u-alert-tips.vue +36 -10
  6. package/components/u-avatar/types.ts +2 -0
  7. package/components/u-avatar/u-avatar.vue +31 -7
  8. package/components/u-avatar-cropper/u-avatar-cropper.vue +13 -2
  9. package/components/u-avatar-cropper/weCropper.js +36 -8
  10. package/components/u-avatar-cropper/weCropper.ts +28 -7
  11. package/components/u-back-top/types.ts +2 -5
  12. package/components/u-back-top/u-back-top.vue +31 -16
  13. package/components/u-badge/types.ts +2 -0
  14. package/components/u-badge/u-badge.vue +33 -15
  15. package/components/u-button/types.ts +2 -2
  16. package/components/u-button/u-button.vue +34 -11
  17. package/components/u-calendar/types.ts +3 -1
  18. package/components/u-calendar/u-calendar.vue +172 -17
  19. package/components/u-car-keyboard/types.ts +2 -0
  20. package/components/u-car-keyboard/u-car-keyboard.vue +36 -8
  21. package/components/u-card/types.ts +2 -0
  22. package/components/u-card/u-card.vue +25 -10
  23. package/components/u-cell-group/types.ts +2 -0
  24. package/components/u-cell-group/u-cell-group.vue +15 -5
  25. package/components/u-cell-item/types.ts +2 -0
  26. package/components/u-cell-item/u-cell-item.vue +37 -13
  27. package/components/u-checkbox/types.ts +2 -0
  28. package/components/u-checkbox/u-checkbox.vue +9 -13
  29. package/components/u-checkbox-group/types.ts +2 -0
  30. package/components/u-checkbox-group/u-checkbox-group.vue +1 -1
  31. package/components/u-circle-progress/types.ts +2 -0
  32. package/components/u-circle-progress/u-circle-progress.vue +30 -11
  33. package/components/u-city-select/types.ts +2 -0
  34. package/components/u-city-select/u-city-select.vue +48 -8
  35. package/components/u-col/types.ts +2 -0
  36. package/components/u-col/u-col.vue +27 -8
  37. package/components/u-collapse/u-collapse.vue +8 -13
  38. package/components/u-collapse-item/u-collapse-item.vue +21 -42
  39. package/components/u-column-notice/types.ts +2 -0
  40. package/components/u-column-notice/u-column-notice.vue +54 -8
  41. package/components/u-count-down/types.ts +2 -0
  42. package/components/u-count-down/u-count-down.vue +39 -11
  43. package/components/u-count-to/types.ts +2 -0
  44. package/components/u-count-to/u-count-to.vue +34 -9
  45. package/components/u-divider/types.ts +2 -0
  46. package/components/u-divider/u-divider.vue +36 -12
  47. package/components/u-dropdown/types.ts +2 -0
  48. package/components/u-dropdown/u-dropdown.vue +64 -23
  49. package/components/u-dropdown-item/types.ts +2 -0
  50. package/components/u-dropdown-item/u-dropdown-item.vue +39 -42
  51. package/components/u-empty/types.ts +2 -0
  52. package/components/u-empty/u-empty.vue +20 -5
  53. package/components/u-field/types.ts +2 -0
  54. package/components/u-field/u-field.vue +41 -7
  55. package/components/u-form/types.ts +2 -0
  56. package/components/u-form/u-form.vue +25 -27
  57. package/components/u-form-item/types.ts +2 -0
  58. package/components/u-form-item/u-form-item.vue +104 -74
  59. package/components/u-full-screen/types.ts +2 -0
  60. package/components/u-full-screen/u-full-screen.vue +24 -3
  61. package/components/u-gap/types.ts +2 -0
  62. package/components/u-gap/u-gap.vue +15 -5
  63. package/components/u-grid/types.ts +2 -0
  64. package/components/u-grid/u-grid.vue +23 -25
  65. package/components/u-grid-item/types.ts +3 -3
  66. package/components/u-grid-item/u-grid-item.vue +43 -43
  67. package/components/u-icon/types.ts +0 -1
  68. package/components/u-icon/u-icon.vue +20 -5
  69. package/components/u-image/u-image.vue +23 -6
  70. package/components/u-index-anchor/types.ts +3 -3
  71. package/components/u-index-anchor/u-index-anchor.vue +18 -10
  72. package/components/u-index-list/u-index-list.vue +9 -12
  73. package/components/u-input/types.ts +2 -5
  74. package/components/u-input/u-input.vue +34 -10
  75. package/components/u-keyboard/u-keyboard.vue +26 -6
  76. package/components/u-lazy-load/u-lazy-load.vue +23 -10
  77. package/components/u-line/u-line.vue +13 -4
  78. package/components/u-line-progress/u-line-progress.vue +22 -5
  79. package/components/u-link/u-link.vue +13 -4
  80. package/components/u-loading/u-loading.vue +20 -5
  81. package/components/u-loading-popup/u-loading-popup.vue +14 -0
  82. package/components/u-loadmore/u-loadmore.vue +19 -3
  83. package/components/u-mask/types.ts +2 -5
  84. package/components/u-mask/u-mask.vue +21 -14
  85. package/components/u-message-input/u-message-input.vue +32 -6
  86. package/components/u-modal/u-modal.vue +21 -5
  87. package/components/u-navbar/u-navbar.vue +31 -6
  88. package/components/u-no-network/u-no-network.vue +16 -3
  89. package/components/u-notice-bar/u-notice-bar.vue +19 -4
  90. package/components/u-number-box/u-number-box.vue +13 -4
  91. package/components/u-number-keyboard/u-number-keyboard.vue +32 -10
  92. package/components/u-picker/u-picker.vue +62 -14
  93. package/components/u-popup/types.ts +2 -2
  94. package/components/u-popup/u-popup.vue +33 -7
  95. package/components/u-radio/types.ts +2 -0
  96. package/components/u-radio/u-radio.vue +45 -24
  97. package/components/u-radio-group/types.ts +2 -0
  98. package/components/u-radio-group/u-radio-group.vue +20 -22
  99. package/components/u-rate/types.ts +2 -0
  100. package/components/u-rate/u-rate.vue +20 -5
  101. package/components/u-read-more/types.ts +2 -0
  102. package/components/u-read-more/u-read-more.vue +30 -8
  103. package/components/u-root-portal/u-root-portal.vue +3 -1
  104. package/components/u-row/types.ts +2 -0
  105. package/components/u-row/u-row.vue +29 -11
  106. package/components/u-row-notice/types.ts +2 -0
  107. package/components/u-row-notice/u-row-notice.vue +51 -8
  108. package/components/u-safe-bottom/u-safe-bottom.vue +13 -2
  109. package/components/u-search/types.ts +2 -0
  110. package/components/u-search/u-search.vue +30 -7
  111. package/components/u-section/types.ts +2 -0
  112. package/components/u-section/u-section.vue +38 -13
  113. package/components/u-select/types.ts +2 -0
  114. package/components/u-select/u-select.vue +37 -10
  115. package/components/u-skeleton/types.ts +2 -0
  116. package/components/u-skeleton/u-skeleton.vue +32 -6
  117. package/components/u-slider/types.ts +2 -0
  118. package/components/u-slider/u-slider.vue +38 -21
  119. package/components/u-status-bar/u-status-bar.vue +13 -4
  120. package/components/u-steps/types.ts +2 -0
  121. package/components/u-steps/u-steps.vue +26 -5
  122. package/components/u-sticky/types.ts +2 -0
  123. package/components/u-sticky/u-sticky.vue +27 -8
  124. package/components/u-subsection/types.ts +2 -0
  125. package/components/u-subsection/u-subsection.vue +14 -3
  126. package/components/u-swipe-action/types.ts +2 -0
  127. package/components/u-swipe-action/u-swipe-action.vue +27 -4
  128. package/components/u-swiper/types.ts +2 -0
  129. package/components/u-swiper/u-swiper.vue +50 -8
  130. package/components/u-switch/types.ts +2 -0
  131. package/components/u-switch/u-switch.vue +19 -5
  132. package/components/u-tabbar/types.ts +2 -0
  133. package/components/u-tabbar/u-tabbar.vue +42 -7
  134. package/components/u-table/types.ts +2 -0
  135. package/components/u-table/u-table.vue +15 -3
  136. package/components/u-tabs/types.ts +2 -0
  137. package/components/u-tabs/u-tabs.vue +22 -4
  138. package/components/u-tabs-swiper/types.ts +2 -0
  139. package/components/u-tabs-swiper/u-tabs-swiper.vue +36 -6
  140. package/components/u-tag/types.ts +2 -0
  141. package/components/u-tag/u-tag.vue +31 -7
  142. package/components/u-td/types.ts +2 -0
  143. package/components/u-td/u-td.vue +14 -3
  144. package/components/u-text/types.ts +4 -1
  145. package/components/u-text/u-text.vue +22 -5
  146. package/components/u-th/types.ts +2 -0
  147. package/components/u-th/u-th.vue +14 -3
  148. package/components/u-time-line/u-time-line.vue +17 -3
  149. package/components/u-time-line-item/types.ts +2 -0
  150. package/components/u-time-line-item/u-time-line-item.vue +15 -3
  151. package/components/u-toast/types.ts +2 -0
  152. package/components/u-toast/u-toast.vue +15 -8
  153. package/components/u-top-tips/types.ts +2 -0
  154. package/components/u-top-tips/u-top-tips.vue +20 -3
  155. package/components/u-tr/types.ts +4 -1
  156. package/components/u-tr/u-tr.vue +17 -2
  157. package/components/u-upload/types.ts +10 -2
  158. package/components/u-upload/u-upload.vue +31 -8
  159. package/components/u-verification-code/types.ts +2 -0
  160. package/components/u-verification-code/u-verification-code.vue +15 -3
  161. package/components/u-waterfall/types.ts +2 -0
  162. package/components/u-waterfall/u-waterfall.vue +15 -3
  163. package/iconfont.css +2 -1
  164. package/libs/css/style.vue.scss +1 -1
  165. package/libs/function/$parent.ts +4 -1
  166. package/libs/function/colorGradient.ts +18 -4
  167. package/libs/function/deepMerge.ts +2 -1
  168. package/libs/function/getParent.ts +5 -1
  169. package/libs/function/md5.ts +17 -5
  170. package/libs/function/queryParams.ts +5 -1
  171. package/libs/function/test.ts +7 -3
  172. package/libs/function/timeFormat.ts +2 -1
  173. package/libs/function/type2icon.ts +4 -1
  174. package/libs/hooks/index.ts +2 -1
  175. package/libs/hooks/useCompRelation.ts +364 -0
  176. package/libs/hooks/useComponent.ts +485 -69
  177. package/libs/hooks/useEmitter.ts +4 -2
  178. package/libs/index.ts +56 -39
  179. package/libs/request/index.ts +24 -5
  180. package/libs/util/async-validator.d.ts +16 -3
  181. package/libs/util/emitter.ts +12 -2
  182. package/libs/util/mitt.ts +4 -1
  183. package/package.json +1 -1
  184. package/readme.md +6 -6
@@ -1,10 +1,12 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
+ import { baseProps } from '../common/props';
2
3
 
3
4
  /**
4
5
  * VerificationCodeProps 验证码输入框 props 类型定义
5
6
  * @description 验证码输入倒计时组件
6
7
  */
7
8
  export const VerificationCodeProps = {
9
+ ...baseProps,
8
10
  /** 倒计时时长,单位秒 */
9
11
  seconds: { type: [String, Number] as PropType<string | number>, default: 60 },
10
12
  /** 开始时按钮文字 */
@@ -1,14 +1,26 @@
1
1
  <template>
2
- <view class="u-code-wrap">
2
+ <view class="u-code-wrap" :class="customClass" :style="$u.toStyle(customStyle)">
3
3
  <!-- 此组件功能由js完成,无需写html逻辑 -->
4
4
  </view>
5
5
  </template>
6
6
 
7
+ <script lang="ts">
8
+ export default {
9
+ name: 'u-verification-code',
10
+ options: {
11
+ addGlobalClass: true,
12
+ // #ifndef MP-TOUTIAO
13
+ virtualHost: true,
14
+ // #endif
15
+ styleIsolation: 'shared'
16
+ }
17
+ };
18
+ </script>
19
+
7
20
  <script setup lang="ts">
8
21
  import { ref, watch, onMounted, onBeforeUnmount } from 'vue';
9
22
  import { VerificationCodeProps } from './types';
10
-
11
- defineOptions({ name: 'u-verification-code' });
23
+ import { $u } from '../../';
12
24
 
13
25
  /**
14
26
  * verificationCode 验证码输入框
@@ -1,10 +1,12 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
+ import { baseProps } from '../common/props';
2
3
 
3
4
  /**
4
5
  * WaterfallProps waterfall props 类型定义
5
6
  * @description 瀑布流组件,支持数据、间隔、idKey
6
7
  */
7
8
  export const WaterfallProps = {
9
+ ...baseProps,
8
10
  /** 瀑布流数据数组,必填 */
9
11
  modelValue: { type: Array as PropType<any[]>, required: true, default: () => [] },
10
12
  /** 新增数据的动画间隔,单位ms */
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="u-waterfall">
2
+ <view class="u-waterfall" :class="customClass" :style="$u.toStyle(customStyle)">
3
3
  <view id="u-left-column" class="u-column">
4
4
  <slot name="left" :leftList="leftList"></slot>
5
5
  </view>
@@ -8,13 +8,25 @@
8
8
  </view>
9
9
  </view>
10
10
  </template>
11
+
12
+ <script lang="ts">
13
+ export default {
14
+ name: 'u-waterfall',
15
+ options: {
16
+ addGlobalClass: true,
17
+ // #ifndef MP-TOUTIAO
18
+ virtualHost: true,
19
+ // #endif
20
+ styleIsolation: 'shared'
21
+ }
22
+ };
23
+ </script>
24
+
11
25
  <script setup lang="ts">
12
26
  import { ref, computed, watch, onMounted, getCurrentInstance } from 'vue';
13
27
  import { $u } from '../..';
14
28
  import { WaterfallProps } from './types';
15
29
 
16
- defineOptions({ name: 'u-waterfall' });
17
-
18
30
  /**
19
31
  * waterfall 瀑布流
20
32
  * @description 这是一个瀑布流形式的组件,内容分为左右两列,结合uView的懒加载组件效果更佳。相较于某些只是奇偶数左右分别,或者没有利用vue作用域插槽的做法,uView的瀑布流实现了真正的 组件化,搭配LazyLoad 懒加载和loadMore 加载更多组件,让您开箱即用,眼前一亮。
package/iconfont.css CHANGED
@@ -23,7 +23,8 @@
23
23
  format('woff2'),
24
24
  url('//at.alicdn.com/t/font_1529455_k4s6di1d1.woff?t=1596960292384') format('woff'),
25
25
  url('//at.alicdn.com/t/font_1529455_k4s6di1d1.ttf?t=1596960292384') format('truetype'),
26
- /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ url('//at.alicdn.com/t/font_1529455_k4s6di1d1.svg?t=1596960292384#iconfont') format('svg');
26
+ /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
27
+ url('//at.alicdn.com/t/font_1529455_k4s6di1d1.svg?t=1596960292384#iconfont') format('svg');
27
28
  }
28
29
 
29
30
  /* #endif */
@@ -52,7 +52,7 @@ page {
52
52
 
53
53
  /* #ifndef APP-NVUE */
54
54
  // vue下,单行和多行显示省略号需要单独处理
55
- @if $i == '1' {
55
+ @if $i == 1 {
56
56
  overflow: hidden;
57
57
  white-space: nowrap;
58
58
  text-overflow: ellipsis;
@@ -4,7 +4,10 @@
4
4
  // 值(默认为undefined),就是查找最顶层的$parent
5
5
  import { type ComponentInternalInstance, getCurrentInstance } from 'vue';
6
6
 
7
- export default function $parent(componentName?: string, _instance: ComponentInternalInstance | null | undefined = null) {
7
+ export default function $parent(
8
+ componentName?: string,
9
+ _instance: ComponentInternalInstance | null | undefined = null
10
+ ) {
8
11
  const instance: ComponentInternalInstance | null | undefined = _instance || getCurrentInstance();
9
12
  let parent = instance && (instance.parent as ComponentInternalInstance | null | undefined);
10
13
 
@@ -5,7 +5,11 @@
5
5
  * @param step 颜色等分的份额
6
6
  * @returns 渐变色数组
7
7
  */
8
- function colorGradient(startColor: string = 'rgb(0, 0, 0)', endColor: string = 'rgb(255, 255, 255)', step: number = 10): string[] {
8
+ function colorGradient(
9
+ startColor: string = 'rgb(0, 0, 0)',
10
+ endColor: string = 'rgb(255, 255, 255)',
11
+ step: number = 10
12
+ ): string[] {
9
13
  const startRGB = hexToRgb(startColor, false) as [number, number, number]; // 转换为rgb数组模式
10
14
  const [startR, startG, startB] = startRGB;
11
15
  const endRGB = hexToRgb(endColor, false) as [number, number, number];
@@ -17,7 +21,9 @@ function colorGradient(startColor: string = 'rgb(0, 0, 0)', endColor: string = '
17
21
  const colorArr: string[] = [];
18
22
  for (let i = 0; i < step; i++) {
19
23
  // 计算每一步的hex值
20
- const hex = rgbToHex(`rgb(${Math.round(sR * i + startR)},${Math.round(sG * i + startG)},${Math.round(sB * i + startB)})`);
24
+ const hex = rgbToHex(
25
+ `rgb(${Math.round(sR * i + startR)},${Math.round(sG * i + startG)},${Math.round(sB * i + startB)})`
26
+ );
21
27
  colorArr.push(hex as string);
22
28
  }
23
29
  return colorArr;
@@ -41,7 +47,11 @@ function hexToRgb(sColor: string, str: boolean = true): [number, number, number]
41
47
  sColor = sColorNew;
42
48
  }
43
49
  // 处理六位的颜色值
44
- const sColorChange: [number, number, number] = [parseInt('0x' + sColor.slice(1, 3)), parseInt('0x' + sColor.slice(3, 5)), parseInt('0x' + sColor.slice(5, 7))];
50
+ const sColorChange: [number, number, number] = [
51
+ parseInt('0x' + sColor.slice(1, 3)),
52
+ parseInt('0x' + sColor.slice(3, 5)),
53
+ parseInt('0x' + sColor.slice(5, 7))
54
+ ];
45
55
  if (!str) {
46
56
  return sColorChange;
47
57
  } else {
@@ -110,7 +120,11 @@ function colorToRgba(color: string, alpha: number = 0.3): string {
110
120
  }
111
121
  sColor = sColorNew;
112
122
  }
113
- const sColorChange: [number, number, number] = [parseInt('0x' + sColor.slice(1, 3)), parseInt('0x' + sColor.slice(3, 5)), parseInt('0x' + sColor.slice(5, 7))];
123
+ const sColorChange: [number, number, number] = [
124
+ parseInt('0x' + sColor.slice(1, 3)),
125
+ parseInt('0x' + sColor.slice(3, 5)),
126
+ parseInt('0x' + sColor.slice(5, 7))
127
+ ];
114
128
  return `rgba(${sColorChange.join(',')},${alpha})`;
115
129
  } else {
116
130
  return sColor;
@@ -8,7 +8,8 @@ import deepClone from './deepClone';
8
8
  */
9
9
  function deepMerge<T extends object, S extends object>(target: T = {} as T, source: S = {} as S): T & S {
10
10
  target = deepClone(target);
11
- if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null) return target as T & S;
11
+ if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null)
12
+ return target as T & S;
12
13
  const merged: any = Array.isArray(target) ? target.slice() : Object.assign({}, target);
13
14
  for (const prop in source) {
14
15
  if (!Object.prototype.hasOwnProperty.call(source, prop)) continue;
@@ -13,7 +13,11 @@ interface VueInstance {
13
13
  * @param keys 需要获取的参数名数组或对象
14
14
  * @returns 父组件参数对象
15
15
  */
16
- export default function getParent(this: VueInstance, name: string, keys: string[] | Record<string, any>): Record<string, any> {
16
+ export default function getParent(
17
+ this: VueInstance,
18
+ name: string,
19
+ keys: string[] | Record<string, any>
20
+ ): Record<string, any> {
17
21
  let parent = this.$parent;
18
22
  // 通过while历遍,这里主要是为了H5需要多层解析的问题
19
23
  while (parent) {
@@ -112,7 +112,10 @@ function rstr2b64(input: string): string {
112
112
  let output = '';
113
113
  const len: number = input.length;
114
114
  for (let i = 0; i < len; i += 3) {
115
- const triplet: number = (input.charCodeAt(i) << 16) | (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) | (i + 2 < len ? input.charCodeAt(i + 2) : 0);
115
+ const triplet: number =
116
+ (input.charCodeAt(i) << 16) |
117
+ (i + 1 < len ? input.charCodeAt(i + 1) << 8 : 0) |
118
+ (i + 2 < len ? input.charCodeAt(i + 2) : 0);
116
119
  for (let j = 0; j < 4; j++) {
117
120
  if (i * 8 + j * 6 > input.length * 8) output += b64pad;
118
121
  else output += tab.charAt((triplet >>> (6 * (3 - j))) & 0x3f);
@@ -187,8 +190,15 @@ function str2rstr_utf8(input: string): string {
187
190
  /* Encode output as utf-8 */
188
191
  if (x <= 0x7f) output += String.fromCharCode(x);
189
192
  else if (x <= 0x7ff) output += String.fromCharCode(0xc0 | ((x >>> 6) & 0x1f), 0x80 | (x & 0x3f));
190
- else if (x <= 0xffff) output += String.fromCharCode(0xe0 | ((x >>> 12) & 0x0f), 0x80 | ((x >>> 6) & 0x3f), 0x80 | (x & 0x3f));
191
- else if (x <= 0x1fffff) output += String.fromCharCode(0xf0 | ((x >>> 18) & 0x07), 0x80 | ((x >>> 12) & 0x3f), 0x80 | ((x >>> 6) & 0x3f), 0x80 | (x & 0x3f));
193
+ else if (x <= 0xffff)
194
+ output += String.fromCharCode(0xe0 | ((x >>> 12) & 0x0f), 0x80 | ((x >>> 6) & 0x3f), 0x80 | (x & 0x3f));
195
+ else if (x <= 0x1fffff)
196
+ output += String.fromCharCode(
197
+ 0xf0 | ((x >>> 18) & 0x07),
198
+ 0x80 | ((x >>> 12) & 0x3f),
199
+ 0x80 | ((x >>> 6) & 0x3f),
200
+ 0x80 | (x & 0x3f)
201
+ );
192
202
  }
193
203
  return output;
194
204
  }
@@ -200,7 +210,8 @@ function str2rstr_utf8(input: string): string {
200
210
  */
201
211
  function str2rstr_utf16le(input: string): string {
202
212
  let output = '';
203
- for (let i = 0; i < input.length; i++) output += String.fromCharCode(input.charCodeAt(i) & 0xff, (input.charCodeAt(i) >>> 8) & 0xff);
213
+ for (let i = 0; i < input.length; i++)
214
+ output += String.fromCharCode(input.charCodeAt(i) & 0xff, (input.charCodeAt(i) >>> 8) & 0xff);
204
215
  return output;
205
216
  }
206
217
 
@@ -211,7 +222,8 @@ function str2rstr_utf16le(input: string): string {
211
222
  */
212
223
  function str2rstr_utf16be(input: string): string {
213
224
  let output = '';
214
- for (let i = 0; i < input.length; i++) output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xff, input.charCodeAt(i) & 0xff);
225
+ for (let i = 0; i < input.length; i++)
226
+ output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xff, input.charCodeAt(i) & 0xff);
215
227
  return output;
216
228
  }
217
229
 
@@ -5,7 +5,11 @@
5
5
  * @param arrayFormat 数组参数格式,indices/brackets/repeat/comma,默认brackets
6
6
  * @returns url参数字符串
7
7
  */
8
- function queryParams(data: Record<string, any> = {}, isPrefix: boolean = true, arrayFormat: 'indices' | 'brackets' | 'repeat' | 'comma' = 'brackets'): string {
8
+ function queryParams(
9
+ data: Record<string, any> = {},
10
+ isPrefix: boolean = true,
11
+ arrayFormat: 'indices' | 'brackets' | 'repeat' | 'comma' = 'brackets'
12
+ ): string {
9
13
  const prefix = isPrefix ? '?' : '';
10
14
  const _result: string[] = [];
11
15
  if (!['indices', 'brackets', 'repeat', 'comma'].includes(arrayFormat)) arrayFormat = 'brackets';
@@ -2,7 +2,9 @@
2
2
  * 验证电子邮箱格式
3
3
  */
4
4
  function email(value: string): boolean {
5
- return /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(value);
5
+ return /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/.test(
6
+ value
7
+ );
6
8
  }
7
9
 
8
10
  /**
@@ -59,9 +61,11 @@ function idCard(value: string): boolean {
59
61
  */
60
62
  function carNo(value: string): boolean {
61
63
  // 新能源车牌
62
- const xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
64
+ const xreg =
65
+ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
63
66
  // 旧车牌
64
- const creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
67
+ const creg =
68
+ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
65
69
  if (value.length === 7) {
66
70
  return creg.test(value);
67
71
  } else if (value.length === 8) {
@@ -3,7 +3,8 @@
3
3
  if (!String.prototype.padStart) {
4
4
  // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
5
5
  String.prototype.padStart = function (this: string, maxLength: number, fillString: string = ' '): string {
6
- if (Object.prototype.toString.call(fillString) !== '[object String]') throw new TypeError('fillString must be String');
6
+ if (Object.prototype.toString.call(fillString) !== '[object String]')
7
+ throw new TypeError('fillString must be String');
7
8
  let str = this;
8
9
  if (str.length >= maxLength) return String(str);
9
10
  let fillLength = maxLength - str.length,
@@ -4,7 +4,10 @@
4
4
  * @param fill 是否使用fill填充实体的图标,默认false
5
5
  * @returns 图标名称字符串
6
6
  */
7
- function type2icon(type: 'primary' | 'info' | 'error' | 'warning' | 'success' = 'success', fill: boolean = false): string {
7
+ function type2icon(
8
+ type: 'primary' | 'info' | 'error' | 'warning' | 'success' = 'success',
9
+ fill: boolean = false
10
+ ): string {
8
11
  // 如果非预置值,默认为success
9
12
  if (!['primary', 'info', 'error', 'warning', 'success'].includes(type)) type = 'success';
10
13
  let iconName = '';
@@ -1,3 +1,4 @@
1
- export * from './useComponent';
1
+ // export * from './useComponent';
2
2
  export * from './useEmitter';
3
3
  export * from './useRect';
4
+ export * from './useCompRelation';