fusions-ui 1.2.4 → 1.2.6

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 (176) hide show
  1. package/components/fu-avatar/fu-avatar.vue +4 -2
  2. package/components/fu-avatar/props.js +52 -15
  3. package/components/fu-avatar-group/fu-avatar-group.vue +3 -2
  4. package/components/fu-avatar-group/props.js +31 -9
  5. package/components/fu-badge/fu-badge.vue +8 -14
  6. package/components/fu-badge/props.js +56 -16
  7. package/components/fu-banner-arc/fu-banner-arc.vue +4 -5
  8. package/components/fu-banner-arc/props.js +15 -4
  9. package/components/fu-button/fu-button.vue +18 -20
  10. package/components/fu-button/props.js +108 -35
  11. package/components/fu-cell/fu-cell.vue +9 -8
  12. package/components/fu-cell-group/fu-cell-group.vue +2 -1
  13. package/components/fu-cell-group/props.js +7 -2
  14. package/components/fu-checkbox/fu-checkbox.vue +5 -4
  15. package/components/fu-checkbox/props.js +51 -14
  16. package/components/fu-code-input/fu-code-input.vue +10 -6
  17. package/components/fu-code-input/props.js +66 -17
  18. package/components/fu-code-verify/fu-code-verify.vue +9 -5
  19. package/components/fu-code-verify/props.js +64 -17
  20. package/components/fu-collapse/fu-collapse.vue +10 -3
  21. package/components/fu-collapse/props.js +9 -3
  22. package/components/fu-collapse-item/fu-collapse-item.vue +45 -31
  23. package/components/fu-collapse-item/props.js +49 -16
  24. package/components/fu-countdown/fu-countdown.vue +2 -1
  25. package/components/fu-countdown/props.js +15 -4
  26. package/components/fu-datetime-picker/fu-datetime-picker.vue +6 -5
  27. package/components/fu-datetime-picker/props.js +91 -25
  28. package/components/fu-form/fu-form.vue +2 -1
  29. package/components/fu-form/props.js +34 -6
  30. package/components/fu-form-item/fu-form-item.vue +26 -33
  31. package/components/fu-form-item/props.js +30 -8
  32. package/components/fu-grid/fu-grid.vue +16 -17
  33. package/components/fu-grid/props.js +20 -5
  34. package/components/fu-grid-item/fu-grid-item.vue +31 -35
  35. package/components/fu-grid-item/props.js +11 -3
  36. package/components/fu-icon/fu-icon.vue +107 -0
  37. package/components/fu-icon/icon.css +584 -0
  38. package/components/{fu-icons/icons.js → fu-icon/icon.js} +1031 -1031
  39. package/components/{fu-icons/fuicons.ttf → fu-icon/icon.ttf} +0 -0
  40. package/components/fu-icon/props.js +55 -0
  41. package/components/fu-image/fu-image.vue +15 -10
  42. package/components/fu-image/props.js +69 -18
  43. package/components/fu-index-anchor/fu-index-anchor.vue +6 -5
  44. package/components/fu-index-anchor/props.js +20 -6
  45. package/components/fu-index-item/fu-index-item.vue +4 -4
  46. package/components/fu-index-list/fu-index-list.vue +9 -9
  47. package/components/fu-index-list/props.js +19 -6
  48. package/components/fu-input/fu-input.vue +54 -68
  49. package/components/fu-input/props.js +145 -53
  50. package/components/fu-keyboard/fu-keyboard.vue +19 -9
  51. package/components/fu-keyboard/keyboard-car.vue +33 -22
  52. package/components/fu-keyboard/keyboard-number.vue +17 -9
  53. package/components/fu-keyboard/props.js +66 -17
  54. package/components/fu-line/fu-line.vue +17 -13
  55. package/components/fu-line/props.js +30 -5
  56. package/components/fu-link/fu-link.vue +14 -8
  57. package/components/fu-link/props.js +22 -7
  58. package/components/fu-loading/fu-loading.vue +32 -27
  59. package/components/fu-loading/props.js +28 -8
  60. package/components/fu-loading-more/fu-loading-more.vue +19 -23
  61. package/components/fu-loading-more/props.js +27 -13
  62. package/components/fu-modal/fu-modal.vue +11 -6
  63. package/components/fu-modal/props.js +61 -17
  64. package/components/{fu-nav-bar/fu-nav-bar.vue → fu-navbar/fu-navbar.vue} +37 -44
  65. package/components/fu-notice-bar/fu-notice-bar.vue +10 -8
  66. package/components/fu-notice-bar/notice-column.vue +187 -122
  67. package/components/fu-notice-bar/notice-row.vue +85 -28
  68. package/components/fu-notice-bar/props.js +83 -22
  69. package/components/fu-number-box/fu-number-box.vue +26 -28
  70. package/components/fu-number-box/props.js +37 -11
  71. package/components/fu-parse/fu-parse.vue +0 -1
  72. package/components/fu-picker/fu-picker.vue +22 -17
  73. package/components/fu-picker/props.js +70 -19
  74. package/components/fu-popup/fu-popup.vue +38 -43
  75. package/components/fu-popup/props.js +34 -9
  76. package/components/fu-progress/fu-progress.vue +3 -2
  77. package/components/fu-progress/props.js +36 -9
  78. package/components/fu-rate/fu-rate.vue +40 -32
  79. package/components/fu-rate/props.js +47 -13
  80. package/components/fu-read-more/fu-read-more.vue +19 -14
  81. package/components/fu-read-more/props.js +68 -46
  82. package/components/fu-ribbon/fu-ribbon.vue +8 -7
  83. package/components/fu-ribbon/props.js +15 -4
  84. package/components/fu-scroll-list/fu-scroll-list.vue +18 -34
  85. package/components/fu-scroll-list/props.js +19 -10
  86. package/components/fu-search/fu-search.vue +13 -18
  87. package/components/fu-search/props.js +69 -17
  88. package/components/fu-section/fu-section.vue +19 -22
  89. package/components/fu-section/props.js +30 -4
  90. package/components/fu-sign-board/fu-sign-board.vue +18 -3
  91. package/components/fu-sign-board/props.js +15 -5
  92. package/components/fu-skeleton/fu-skeleton.vue +8 -12
  93. package/components/fu-skeleton/props.js +15 -4
  94. package/components/fu-steps/fu-steps.vue +3 -2
  95. package/components/fu-steps/props.js +23 -7
  96. package/components/fu-steps-item/fu-steps-item.vue +3 -3
  97. package/components/fu-steps-item/props.js +15 -5
  98. package/components/fu-sticky/fu-sticky.vue +3 -3
  99. package/components/fu-sticky/props.js +21 -7
  100. package/components/fu-subsection/fu-subsection.vue +29 -22
  101. package/components/fu-subsection/props.js +40 -10
  102. package/components/fu-swipe-action-item/bindingx.js +1 -1
  103. package/components/fu-swipe-action-item/fu-swipe-action-item.vue +134 -123
  104. package/components/fu-swipe-action-item/mpwxs.js +1 -1
  105. package/components/fu-swipe-action-item/props.js +22 -6
  106. package/components/fu-swiper/fu-swiper.vue +29 -27
  107. package/components/fu-swiper/props.js +81 -25
  108. package/components/fu-switch/fu-switch.vue +20 -12
  109. package/components/fu-switch/props.js +48 -13
  110. package/components/fu-tabs/fu-tabs.vue +36 -33
  111. package/components/fu-tabs/props.js +46 -13
  112. package/components/fu-tag/fu-tag.vue +24 -21
  113. package/components/fu-tag/props.js +63 -17
  114. package/components/fu-text/fu-text.vue +72 -33
  115. package/components/fu-text/props.js +85 -27
  116. package/components/fu-text/value.js +6 -6
  117. package/components/fu-textarea/fu-textarea.vue +13 -17
  118. package/components/fu-textarea/props.js +103 -30
  119. package/components/fu-timeaxis/fu-timeaxis.vue +1 -1
  120. package/components/fu-timeaxis-item/fu-timeaxis-item.vue +8 -4
  121. package/components/fu-transition/fu-transition.vue +48 -49
  122. package/components/fu-transition/props.js +21 -0
  123. package/components/fu-upload/fu-upload.vue +3 -1
  124. package/components/fu-upload/props.js +67 -19
  125. package/components/fu-upload/upload-file.vue +31 -18
  126. package/components/fu-upload/upload-image.vue +37 -19
  127. package/components/fu-vtabs/fu-vtabs.vue +6 -4
  128. package/components/fu-vtabs/props.js +50 -15
  129. package/components/fu-waterfall/fu-waterfall.vue +11 -9
  130. package/components/fu-waterfall/props.js +37 -15
  131. package/index.js +17 -24
  132. package/index.scss +9 -7
  133. package/libs/config/config.js +16 -9
  134. package/libs/function/applyEven.js +9 -9
  135. package/libs/function/check.js +81 -89
  136. package/libs/function/{index.js → common.js} +5 -5
  137. package/libs/function/message.js +0 -27
  138. package/libs/mixin/mixin.js +26 -21
  139. package/libs/{utils/min.router.config.js → route/min.route.config.js} +7 -7
  140. package/libs/{utils/router.config.js → route/route.config.js} +10 -11
  141. package/libs/{css/main.scss → style/common.scss} +50 -87
  142. package/libs/style/style.h5.scss +8 -0
  143. package/libs/style/style.mp.scss +15 -0
  144. package/package.json +1 -1
  145. package/components/fu-calendar/calendar-item.vue +0 -214
  146. package/components/fu-calendar/calendar.js +0 -546
  147. package/components/fu-calendar/fu-calendar.vue +0 -536
  148. package/components/fu-calendar/i18n/en.json +0 -12
  149. package/components/fu-calendar/i18n/index.js +0 -8
  150. package/components/fu-calendar/i18n/zh-Hans.json +0 -12
  151. package/components/fu-calendar/i18n/zh-Hant.json +0 -12
  152. package/components/fu-calendar/util.js +0 -360
  153. package/components/fu-date-picker/calendar-item.vue +0 -177
  154. package/components/fu-date-picker/calendar.vue +0 -917
  155. package/components/fu-date-picker/fu-date-picker.vue +0 -1069
  156. package/components/fu-date-picker/i18n/en.json +0 -22
  157. package/components/fu-date-picker/i18n/index.js +0 -8
  158. package/components/fu-date-picker/i18n/zh-Hans.json +0 -22
  159. package/components/fu-date-picker/i18n/zh-Hant.json +0 -22
  160. package/components/fu-date-picker/props.js +0 -68
  161. package/components/fu-date-picker/time-picker.vue +0 -924
  162. package/components/fu-date-picker/util.js +0 -419
  163. package/components/fu-icons/fu-icons.vue +0 -102
  164. package/components/fu-icons/fuicons.css +0 -585
  165. package/components/fu-landscape/fu-landscape.vue +0 -167
  166. package/components/fu-landscape/props.js +0 -64
  167. package/components/fu-tabbar/fu-tabbar.vue +0 -333
  168. package/components/fu-tabbar/props.js +0 -78
  169. package/libs/css/style.h5.scss +0 -35
  170. package/libs/css/style.mp.scss +0 -50
  171. package/libs/utils/util.js +0 -58
  172. /package/components/{fu-nav-bar → fu-navbar}/props.js +0 -0
  173. /package/components/{fu-nav-bar → fu-navbar}/status-bar.vue +0 -0
  174. /package/{components/fu-datetime-picker → libs/function}/dayjs.js +0 -0
  175. /package/libs/{css → style}/color.scss +0 -0
  176. /package/libs/{css/component.scss → style/components.scss} +0 -0
@@ -1,60 +1,82 @@
1
1
  export default {
2
2
  props: {
3
- // 瀑布流数据
4
- // #ifdef VUE2
3
+ /**
4
+ * @description 瀑布流数据
5
+ */
5
6
  value: {
6
7
  type: Array,
7
8
  default: () => []
8
9
  },
9
- // #endif
10
- // #ifdef VUE3
11
10
  modelValue: {
12
11
  type: Array,
13
12
  default: () => []
14
13
  },
15
- // #endif
16
- // 数据的id值,根据id值对数据执行删除操作
17
- // 如数据为:{id: 1, name: 'fusions-ui'},那么该值设置为id
14
+ /**
15
+ * @description 数据的id值,根据id值对数据执行删除操作, 如数据为:{id: 1, name: 'fusions-ui'},那么该值设置为id
16
+ * @default 'id'
17
+ */
18
18
  idKey: {
19
19
  type: String,
20
20
  default: 'id'
21
21
  },
22
- // 前置标识
22
+ /**
23
+ * @description 前置标识
24
+ * @default 'waterfall-flow-'
25
+ */
23
26
  idPrefix: {
24
27
  type: String,
25
28
  default: 'waterfall-flow-'
26
29
  },
27
- // 每次插入数据的事件间隔,间隔越长能保证两列高度相近,但是用户体验不好,单位ms
30
+ /**
31
+ * @description 每次插入数据的事件间隔,间隔越长能保证两列高度相近,但是用户体验不好,单位ms
32
+ * @default 200
33
+ */
28
34
  addTime: {
29
35
  type: Number,
30
36
  default: 200
31
37
  },
32
- // 瀑布流的列数,默认2
38
+ /**
39
+ * @description 瀑布流的列数
40
+ * @default 2
41
+ */
33
42
  columnCount: {
34
43
  type: [String,Number],
35
44
  default: 2
36
45
  },
37
- // 列与列的间隙,默认20
46
+ /**
47
+ * @description 列与列的间隙
48
+ * @default 15
49
+ */
38
50
  columnGap: {
39
51
  type: [String,Number],
40
52
  default: 15
41
53
  },
42
- // 是否显示滚动条,仅nvue生效(默认 false)
54
+ /**
55
+ * @description 是否显示滚动条,仅nvue生效
56
+ * @default false
57
+ */
43
58
  showScrollbar: {
44
59
  type: [Boolean],
45
60
  default: false
46
61
  },
47
- // 列宽,nvue生效
62
+ /**
63
+ * @description 列宽,nvue生效
64
+ * @default 'auto'
65
+ */
48
66
  columnWidth: {
49
67
  type: [String,Number],
50
68
  default: 'auto'
51
69
  },
52
- // 瀑布流的宽度,nvue生效
70
+ /**
71
+ * @description 瀑布流的宽度,nvue生效
72
+ */
53
73
  width: {
54
74
  type: [String,Number],
55
75
  default: ''
56
76
  },
57
- // 瀑布流的高度,nvue生效
77
+ /**
78
+ * @description 瀑布流的高度,nvue生效
79
+ */
58
80
  height: {
59
81
  type: [String,Number],
60
82
  default: ''
package/index.js CHANGED
@@ -4,21 +4,14 @@
4
4
  * Vue.use(FusionsUI)
5
5
  */
6
6
 
7
- // 路由封装
8
- import minRouterConfig from './libs/utils/min.router.config.js'
9
- import routerConfig from './libs/utils/router.config.js'
7
+ // 工具函数
8
+ import * as common from './libs/function/common.js'
10
9
 
11
- import mixin from './libs/mixin/mixin.js'
12
-
13
- // #ifdef MP
14
- import mpShare from './libs/mixin/mpShare.js'
15
- // #endif
16
-
17
- // 公共工具函数
18
- import * as index from './libs/function/index.js'
10
+ // 配置信息
11
+ import config from './libs/config/config.js'
19
12
 
20
13
  // 规则校验
21
- import * as check from './libs/function/check.js'
14
+ import check from './libs/function/check.js'
22
15
 
23
16
  /**
24
17
  * 防抖方法 debounce
@@ -26,27 +19,27 @@ import * as check from './libs/function/check.js'
26
19
  */
27
20
  import { debounce, throttle } from './libs/function/applyEven.js'
28
21
 
22
+ // 内置路由管理
23
+ import minRouteConfig from './libs/route/min.route.config.js'
24
+ import routeConfig from './libs/route/route.config.js'
25
+
29
26
  // 消息工具
30
27
  import message from './libs/function/message.js'
31
28
 
32
- // 配置信息
33
- import config from './libs/config/config.js'
34
-
35
- // 定义全局挂载对象
29
+ // 定义全局挂在对象
36
30
  const $fu = {
37
- ...index,
31
+ config,
32
+ version: config.version,
38
33
  debounce,
39
34
  throttle,
40
- ...message,
35
+ ...common,
41
36
  ...check,
42
- config
37
+ ...message,
43
38
  };
44
39
 
45
- // $fu挂载到uni对象上
40
+ // 将$fu挂载到 uni 对象上
46
41
  uni.$fu = $fu;
47
42
 
48
- // 路由安装标记,避免重复安装冲突
49
-
50
43
  const install = (Vue, options = {}) => {
51
44
  // #ifdef MP
52
45
  if(options.mpShare) {
@@ -55,9 +48,9 @@ const install = (Vue, options = {}) => {
55
48
  }
56
49
  // #endif
57
50
 
58
- // 开启封装内置路由
51
+ // 内置路由
59
52
  if(options.openRouter) {
60
- Vue.use(minRouterConfig, routerConfig)
53
+ Vue.use(minRouteConfig, routeConfig)
61
54
  }
62
55
 
63
56
  // #ifdef VUE2
package/index.scss CHANGED
@@ -1,12 +1,14 @@
1
- // 引入公共基础类
2
- @import "./libs/css/main.scss";
1
+ // 引入公共基础样式
2
+ @import './libs/style/common.scss';
3
+ @import './libs/style/color.scss';
4
+ @import './libs/style/components.scss';
3
5
 
4
- // 小程序特有的样式
6
+ // 小程序特有样式
5
7
  /* #ifdef MP */
6
- @import "./libs/css/style.mp.scss";
8
+ @import './libs/style/style.mp.scss';
7
9
  /* #endif */
8
10
 
9
- // H5特有的样式
11
+ // H5特有样式
10
12
  /* #ifdef H5 */
11
- @import "./libs/css/style.h5.scss";
12
- /* #endif */
13
+ @import 'libs/style/style.h5.scss';
14
+ /* #endif */
@@ -1,18 +1,25 @@
1
1
  import packageInfo from '../../package.json';
2
2
 
3
- // 此版本发布于2025-05-01
3
+ // 此版本发布于2026-10-10
4
4
  const version = packageInfo.version || '1.0.0';
5
5
 
6
- // 开发环境才提示,生产环境不会提示
6
+ // 开发环境提示,生产环境不会提示
7
7
  if (process.env.NODE_ENV === 'development') {
8
-
9
- var t = " \n _ \n |_ _ o _ _ _ \n | |_| _> | (_) | | _> \n ┌========================================┐\n == Version (".concat(version, ") == \n ");
8
+ const t = `
9
+ _
10
+ |_ _ o _ _ _
11
+ | |_| _> | (_) | | _>
12
+ ┌========================================┐
13
+ == Version (${version}) ==
14
+ `;
10
15
  console.log("%c ".concat(t), "color: #2979ff;");
11
16
  }
12
17
 
13
- export default {
14
- v: version,
15
- version,
16
- // 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx
18
+ const config = {
19
+ v: version,
20
+ version,
21
+ // 默认单位,可以通过配置为rpx,在用于传入组件大小参数为数值时,就默认为rpx
17
22
  unit: 'px'
18
- }
23
+ };
24
+
25
+ export default config
@@ -1,4 +1,4 @@
1
- let timeout = null
1
+ let timeout = null;
2
2
  /**
3
3
  * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
4
4
  * @param {Function} func 要执行的回调函数
@@ -11,16 +11,16 @@ export function debounce(func, wait = 500, immediate = false) {
11
11
  if (timeout !== null) clearTimeout(timeout)
12
12
  // 立即执行,此类情况一般用不到
13
13
  if (immediate) {
14
- const callNow = !timeout
14
+ const callNow = !timeout;
15
15
  timeout = setTimeout(() => {
16
- timeout = null
16
+ timeout = null;
17
17
  }, wait)
18
18
  if (callNow) typeof func === 'function' && func()
19
19
  } else {
20
20
  // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
21
21
  timeout = setTimeout(() => {
22
22
  typeof func === 'function' && func()
23
- }, wait)
23
+ }, wait);
24
24
  }
25
25
  }
26
26
 
@@ -36,18 +36,18 @@ let timer; let flag;
36
36
  export function throttle(func, wait = 500, immediate = true) {
37
37
  if (immediate) {
38
38
  if (!flag) {
39
- flag = true
39
+ flag = true;
40
40
  // 如果是立即执行,则在wait毫秒内开始时执行
41
41
  typeof func === 'function' && func()
42
42
  timer = setTimeout(() => {
43
- flag = false
44
- }, wait)
43
+ flag = false;
44
+ }, wait);
45
45
  }
46
46
  } else if (!flag) {
47
- flag = true
47
+ flag = true;
48
48
  // 如果是非立即执行,则在wait毫秒内的结束处执行
49
49
  timer = setTimeout(() => {
50
- flag = false
50
+ flag = false;
51
51
  typeof func === 'function' && func()
52
52
  }, wait)
53
53
  }
@@ -1,4 +1,4 @@
1
- /*!
1
+ /*
2
2
  * 校验类:常用数据校验工具
3
3
  * Util - v1.0.0 (2025/05/01, 10:10:00 AM)
4
4
  */
@@ -6,33 +6,27 @@
6
6
  /**
7
7
  * @description 校验手机号码格式
8
8
  * @param {String|Number} mobile 手机号
9
- * 返回说明
10
- * @value true 校验通过
11
- * @value false 校验失败(手机号格式不正确)
9
+ * @returns {Boolean} 如果正确返回 true,否则返回 false(手机号格式不正确)
12
10
  */
13
- function checkMobile(mobile) {
11
+ export function checkMobile(mobile) {
14
12
  return RegExp(/^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(16[0-9]{1})|(18[0-9]{1})|(17[0-9]{1})|(19[0-9]{1}))+\d{8})$/).test(mobile);
15
13
  }
16
14
 
17
15
  /**
18
- * @description 校验电子邮箱格式
16
+ * @description 校验邮箱格式
19
17
  * @param {String|Number} value 电子邮箱
20
- * 返回说明
21
- * @value true 校验通过
22
- * @value false 校验失败(电子邮箱格式不正确)
18
+ * @returns {Boolean} 如果正确返回 true,否则返回 false(邮箱格式不正确)
23
19
  */
24
- function checkEmail(value) {
20
+ export function checkEmail(value) {
25
21
  return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value)
26
22
  }
27
23
 
28
24
  /**
29
25
  * @description 校验身份证号
30
26
  * @param {String|Number} card 身份证号
31
- * 返回说明
32
- * @value true 校验通过
33
- * @value false 校验失败(身份证号格式不正确)
27
+ * @returns {Boolean} 如果正确返回 true,否则返回 false(身份证号格式不正确)
34
28
  */
35
- function checkIDNumber(card) {
29
+ export function checkIDNumber(card) {
36
30
  // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
37
31
  var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
38
32
  if (reg.test(card) === false) {
@@ -43,17 +37,68 @@ function checkIDNumber(card) {
43
37
  }
44
38
  }
45
39
 
40
+ /**
41
+ * @description 验证一个值范围[min, max]
42
+ * @param {Number} 校验的值
43
+ * @param {Array} param 校验范围,如:[0, 9]
44
+ */
45
+ export function checkRange(value, param) {
46
+ return value >= param[0] && value <= param[1]
47
+ }
48
+
49
+ /**
50
+ * @description 校验验证码
51
+ * @param {String} value 验证码字符串(要求为数字)
52
+ * @param {Number} len 验证码长度,默认为6
53
+ */
54
+ export function checkCode(value, len = 6) {
55
+ return new RegExp(`^\\d{${len}}$`).test(value)
56
+ }
57
+
58
+ /**
59
+ * @description 验证日期格式
60
+ */
61
+ export function checkDate(value) {
62
+ if (!value) return false
63
+ // 判断是否数值或者字符串数值(意味着为时间戳),转为数值,否则new Date无法识别字符串时间戳
64
+ if (checkNumber(value)) value = +value
65
+ return !/Invalid|NaN/.test(new Date(value).toString())
66
+ }
67
+
68
+ /**
69
+ * @description 校验是否为整数
70
+ */
71
+ export function checkInteger(value) {
72
+ return /^\d+$/.test(value)
73
+ }
74
+
75
+ /**
76
+ * @description 校验旧车牌号和新能源类型的车牌号
77
+ */
78
+ export function checkCarNo(value) {
79
+ // 新能源车牌
80
+ const xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/
81
+ // 旧车牌
82
+ const creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/
83
+ if (value.length === 7) {
84
+ return creg.test(value)
85
+ } if (value.length === 8) {
86
+ return xreg.test(value)
87
+ }
88
+ return false
89
+ }
90
+
46
91
  /**
47
92
  * @description 校验十进制数字
48
93
  */
49
- function number(value) {
94
+ export function checkNumber(value) {
50
95
  return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value)
51
96
  }
52
97
 
53
98
  /**
54
99
  * @description 校验是否json字符串
55
100
  */
56
- function jsonString(value) {
101
+ export function isJsonString(value) {
57
102
  if(typeof value == 'string') {
58
103
  try {
59
104
  var obj = JSON.parse(value);
@@ -72,7 +117,7 @@ function jsonString(value) {
72
117
  /**
73
118
  * @description 是否数组
74
119
  */
75
- function array(value) {
120
+ export function isArray(value) {
76
121
  if (typeof Array.isArray === 'function') {
77
122
  return Array.isArray(value)
78
123
  }
@@ -82,18 +127,16 @@ function array(value) {
82
127
  /**
83
128
  * 是否对象
84
129
  */
85
- function object(value) {
130
+ export function isObject(value) {
86
131
  return Object.prototype.toString.call(value) === '[object Object]'
87
132
  }
88
133
 
89
134
  /**
90
135
  * @description 校验是否为空
91
136
  * @param {String} value 校验值
92
- * 返回说明
93
- * @value true 空
94
- * @value false 非空
137
+ * @returns 如果为空返回true 否则返回false(非空)
95
138
  */
96
- function isNull(value) {
139
+ export function isNull(value) {
97
140
  switch (typeof value) {
98
141
  case 'undefined':
99
142
  return true
@@ -120,7 +163,7 @@ function isNull(value) {
120
163
  * @description 是否图片格式
121
164
  * @param {Object} value
122
165
  */
123
- function isImage(value) {
166
+ export function isImage(value) {
124
167
  const newValue = value.split('?')[0]
125
168
  const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i
126
169
  return IMAGE_REGEXP.test(newValue)
@@ -130,67 +173,16 @@ function isImage(value) {
130
173
  * @description 是否视频格式
131
174
  * @param {Object} value
132
175
  */
133
- function isVideo(value) {
176
+ export function isVideo(value) {
134
177
  const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i
135
178
  return VIDEO_REGEXP.test(value)
136
179
  }
137
180
 
138
- /**
139
- * @description 校验验证码
140
- * @param {String} value 验证码字符串(要求为数字)
141
- * @param {Number} len 验证码长度,默认为6
142
- */
143
- function checkCode(value, len = 6) {
144
- return new RegExp(`^\\d{${len}}$`).test(value)
145
- }
146
-
147
- /**
148
- * @description 验证日期格式
149
- */
150
- function date(value) {
151
- if (!value) return false
152
- // 判断是否数值或者字符串数值(意味着为时间戳),转为数值,否则new Date无法识别字符串时间戳
153
- if (number(value)) value = +value
154
- return !/Invalid|NaN/.test(new Date(value).toString())
155
- }
156
-
157
- /**
158
- * @description 校验是否为整数
159
- */
160
- function checkInteger(value) {
161
- return /^\d+$/.test(value)
162
- }
163
-
164
- /**
165
- * @description 校验旧车牌号和新能源类型的车牌号
166
- */
167
- function checkCarNo(value) {
168
- // 新能源车牌
169
- const xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/
170
- // 旧车牌
171
- const creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/
172
- if (value.length === 7) {
173
- return creg.test(value)
174
- } if (value.length === 8) {
175
- return xreg.test(value)
176
- }
177
- return false
178
- }
179
-
180
- /**
181
- * @description 验证一个值范围[min, max]
182
- * @param {Number} 校验的值
183
- * @param {Array} param 校验范围,如:[0, 9]
184
- */
185
- function checkRange(value, param) {
186
- return value >= param[0] && value <= param[1]
187
- }
188
-
189
181
  /**
190
182
  * @description 验证URL格式
191
183
  * @param value 校验的URL
192
184
  */
193
- function url(value) {
185
+ export function isUrl(value) {
194
186
  return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/.test(value)
195
187
  }
196
188
 
@@ -198,26 +190,26 @@ function url(value) {
198
190
  * @description 是否函数方法
199
191
  * @param {Object} value
200
192
  */
201
- function func(value) {
193
+ export function isFunc(value) {
202
194
  return typeof(value) === 'function'
203
195
  }
204
196
 
205
- export {
197
+ export default {
206
198
  checkMobile,
207
199
  checkEmail,
208
200
  checkIDNumber,
209
- number,
210
- jsonString,
211
- array,
212
- object,
213
- isNull,
214
- isImage,
215
- isVideo,
201
+ checkRange,
216
202
  checkCode,
217
- date,
203
+ checkDate,
218
204
  checkInteger,
219
205
  checkCarNo,
220
- checkRange,
221
- url,
222
- func
206
+ checkNumber,
207
+ isJsonString,
208
+ isArray,
209
+ isObject,
210
+ isNull,
211
+ isImage,
212
+ isVideo,
213
+ isUrl,
214
+ isFunc
223
215
  }
@@ -1,4 +1,4 @@
1
- import { isNull, number } from './check.js'
1
+ import { isNull, checkNumber } from './check.js'
2
2
  import { round } from './digit.js'
3
3
 
4
4
  /**
@@ -70,8 +70,8 @@ function addStyle(customStyle, target = 'object') {
70
70
  */
71
71
  function addUnit(value = 'auto', unit = uni?.$fu?.config?.unit ? uni?.$fu?.config?.unit : 'px') {
72
72
  value = String(value)
73
- // 用Fusions内置验证规则中的number判断是否为数值
74
- return number(value) ? `${value}${unit}` : value
73
+ // 用Fusions内置验证规则中的checkNumber判断是否为数值
74
+ return checkNumber(value) ? `${value}${unit}` : value
75
75
  }
76
76
 
77
77
  /**
@@ -225,7 +225,7 @@ function range(min = 0, max = 0, value = 0) {
225
225
  */
226
226
  function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') {
227
227
  number = (`${number}`).replace(/[^0-9+-Ee.]/g, '')
228
- const n = !isFinite(+number) ? 0 : +number
228
+ const n = !isFinite(+number)? 0: +number
229
229
  const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
230
230
  const sep = (typeof thousandsSeparator === 'undefined') ? ',' : thousandsSeparator
231
231
  const dec = (typeof decimalPoint === 'undefined') ? '.' : decimalPoint
@@ -387,7 +387,7 @@ function trim(str, pos = 'both') {
387
387
  * @returns {number|string}
388
388
  */
389
389
  function getPx(value, unit = false) {
390
- if (number(value)) {
390
+ if (checkNumber(value)) {
391
391
  return unit ? `${value}px` : Number(value)
392
392
  }
393
393
  // 如果带有rpx,先取出其数值部分,再转为px值
@@ -25,32 +25,6 @@ function loading(title) {
25
25
  })
26
26
  }
27
27
 
28
- /**
29
- * 弹出系统内置的modal
30
- */
31
- function modal(title,
32
- content,
33
- confirmCb,
34
- showCancel = false,
35
- cancelCb = null,
36
- confirmText = "确定",
37
- cancelText = "取消") {
38
- uni.showModal({
39
- title: title,
40
- content: content,
41
- showCancel: showCancel,
42
- cancelText: cancelText,
43
- confirmText: confirmText,
44
- success: (res) => {
45
- if (res.cancel) {
46
- cancelCb && cancelCb()
47
- } else if (res.confirm) {
48
- confirmCb && confirmCb()
49
- }
50
- }
51
- })
52
- }
53
-
54
28
  /**
55
29
  * 关闭系统内置toast
56
30
  */
@@ -68,7 +42,6 @@ function closeLoading() {
68
42
  export default {
69
43
  toast,
70
44
  loading,
71
- modal,
72
45
  closeToast,
73
46
  closeLoading
74
47
  }