uview-pro 0.5.15 → 0.5.16

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 (108) hide show
  1. package/changelog.md +37 -8
  2. package/components/u-action-sheet/types.ts +10 -2
  3. package/components/u-action-sheet-item/types.ts +10 -2
  4. package/components/u-alert-tips/types.ts +10 -2
  5. package/components/u-avatar/types.ts +10 -2
  6. package/components/u-back-top/types.ts +10 -2
  7. package/components/u-badge/types.ts +10 -2
  8. package/components/u-button/types.ts +11 -3
  9. package/components/u-button/u-button.vue +17 -0
  10. package/components/u-calendar/types.ts +10 -2
  11. package/components/u-car-keyboard/types.ts +11 -3
  12. package/components/u-card/types.ts +10 -2
  13. package/components/u-cell-group/types.ts +10 -2
  14. package/components/u-cell-item/types.ts +10 -2
  15. package/components/u-checkbox/types.ts +12 -4
  16. package/components/u-checkbox/u-checkbox.vue +73 -9
  17. package/components/u-checkbox-group/types.ts +14 -6
  18. package/components/u-checkbox-group/u-checkbox-group.vue +1 -1
  19. package/components/u-circle-progress/types.ts +10 -2
  20. package/components/u-city-select/types.ts +10 -2
  21. package/components/u-col/types.ts +10 -2
  22. package/components/u-collapse/types.ts +10 -2
  23. package/components/u-collapse-item/types.ts +10 -2
  24. package/components/u-column-notice/types.ts +10 -2
  25. package/components/u-config-provider/types.ts +10 -2
  26. package/components/u-count-down/types.ts +10 -2
  27. package/components/u-count-to/types.ts +10 -2
  28. package/components/u-divider/types.ts +10 -2
  29. package/components/u-dropdown/types.ts +10 -2
  30. package/components/u-dropdown-item/types.ts +10 -2
  31. package/components/u-empty/types.ts +10 -2
  32. package/components/u-fab/types.ts +10 -2
  33. package/components/u-field/types.ts +10 -2
  34. package/components/u-form/types.ts +14 -4
  35. package/components/u-form-item/types.ts +16 -3
  36. package/components/u-form-item/u-form-item.vue +72 -8
  37. package/components/u-full-screen/types.ts +10 -2
  38. package/components/u-gap/types.ts +10 -2
  39. package/components/u-grid/types.ts +10 -2
  40. package/components/u-grid-item/types.ts +10 -2
  41. package/components/u-icon/types.ts +10 -2
  42. package/components/u-image/types.ts +10 -2
  43. package/components/u-index-anchor/types.ts +10 -2
  44. package/components/u-input/types.ts +16 -3
  45. package/components/u-input/u-input.vue +98 -15
  46. package/components/u-loading/types.ts +10 -2
  47. package/components/u-loadmore/types.ts +10 -2
  48. package/components/u-mask/types.ts +10 -2
  49. package/components/u-message-input/types.ts +10 -2
  50. package/components/u-modal/types.ts +10 -2
  51. package/components/u-pagination/types.ts +11 -2
  52. package/components/u-picker/types.ts +10 -2
  53. package/components/u-popup/types.ts +10 -2
  54. package/components/u-radio/types.ts +14 -4
  55. package/components/u-radio/u-radio.vue +78 -10
  56. package/components/u-radio-group/types.ts +12 -4
  57. package/components/u-rate/types.ts +10 -2
  58. package/components/u-read-more/types.ts +10 -2
  59. package/components/u-row/types.ts +10 -2
  60. package/components/u-row-notice/types.ts +10 -2
  61. package/components/u-safe-bottom/types.ts +19 -0
  62. package/components/u-safe-bottom/u-safe-bottom.vue +1 -1
  63. package/components/u-search/types.ts +10 -2
  64. package/components/u-section/types.ts +10 -2
  65. package/components/u-select/types.ts +10 -2
  66. package/components/u-skeleton/types.ts +10 -2
  67. package/components/u-slider/types.ts +10 -2
  68. package/components/u-status-bar/types.ts +21 -0
  69. package/components/u-status-bar/u-status-bar.vue +1 -1
  70. package/components/u-step/types.ts +10 -2
  71. package/components/u-steps/types.ts +10 -2
  72. package/components/u-sticky/types.ts +10 -2
  73. package/components/u-subsection/types.ts +10 -2
  74. package/components/u-swipe-action/types.ts +10 -2
  75. package/components/u-swiper/types.ts +10 -2
  76. package/components/u-switch/types.ts +12 -4
  77. package/components/u-switch/u-switch.vue +60 -5
  78. package/components/u-tabbar/types.ts +10 -2
  79. package/components/u-table/types.ts +10 -2
  80. package/components/u-tabs/types.ts +10 -2
  81. package/components/u-tabs-swiper/types.ts +10 -2
  82. package/components/u-tag/types.ts +10 -2
  83. package/components/u-tag/u-tag.vue +5 -0
  84. package/components/u-td/types.ts +10 -2
  85. package/components/u-text/types.ts +10 -2
  86. package/components/u-textarea/types.ts +16 -5
  87. package/components/u-textarea/u-textarea.vue +85 -5
  88. package/components/u-th/types.ts +10 -2
  89. package/components/u-time-line/u-time-line.vue +13 -2
  90. package/components/u-time-line-item/types.ts +10 -2
  91. package/components/u-toast/types.ts +10 -2
  92. package/components/u-top-tips/types.ts +10 -2
  93. package/components/u-tr/types.ts +11 -3
  94. package/components/u-transition/types.ts +10 -2
  95. package/components/u-upload/types.ts +10 -2
  96. package/components/u-verification-code/types.ts +10 -2
  97. package/components/u-waterfall/types.ts +10 -2
  98. package/index.ts +4 -5
  99. package/libs/config/config.ts +27 -4
  100. package/libs/hooks/useCompRelation.ts +37 -34
  101. package/libs/index.ts +0 -1
  102. package/libs/util/config-provider.ts +24 -25
  103. package/package.json +3 -2
  104. package/types/global.d.ts +7 -9
  105. package/components/common/props.ts +0 -22
  106. package/components/u-safe-bottom/props.ts +0 -11
  107. package/components/u-status-bar/props.ts +0 -13
  108. package/libs/util/logger.ts +0 -364
package/changelog.md CHANGED
@@ -1,19 +1,48 @@
1
- ## 0.5.15(2026-03-25
1
+ ## 0.5.16(2026-03-26
2
2
 
3
- ### 🐛 Bug Fixes | Bug 修复
3
+ ### Features | 新功能
4
4
 
5
- - **u-form:** 修复表单项底部边框默认值逻辑 ([d939fbd](https://github.com/anyup/uView-Pro/commit/d939fbd5df85c266f8a8f5e23ebeca251eee94ec))
6
- - **u-input:** 修复u-input输入框在某些微信小程序平台下,重新获取焦点时会清空输入框的问题 ([cedecfa](https://github.com/anyup/uView-Pro/commit/cedecfa4bf2142046bb512b1d9e87f6c9d77516d))
7
- - **demo:** 优化微信小程序首页u-sticky使用配置 ([cc4e9ac](https://github.com/anyup/uView-Pro/commit/cc4e9ac9f022e7713b2eb2746038a8481729c0b4))
5
+ - **web:** 浏览器平台添加触摸模拟器支持 ([cf96a73](https://github.com/anyup/uView-Pro/commit/cf96a73e09512291143954401aa7850ac59f1207))
6
+ - **u-button:** 新增 large、small 按钮尺寸选项,丰富按钮尺寸规格 ([053d7e8](https://github.com/anyup/uView-Pro/commit/053d7e8ab92af403cdfde36369f38a2aded27288))
7
+ - **u-input:** u-input添加size属性,支持small/default/large预设值以及自定义尺寸(#137) ([afed961](https://github.com/anyup/uView-Pro/commit/afed961f65c86bd84a2b02828bb361480c7f95b3))
8
+ - **u-textarea:** u-textarea组件新增size属性,支持small/default/large预设值以及自定义数值(#137) ([47296e8](https://github.com/anyup/uView-Pro/commit/47296e8669d419d41959dff01de758a610122d34))
9
+ - **u-checkbox:** u-checkbox,u-checkbox-group支持small/default/large预设尺寸配置,优化组件样式(#137) ([e8918e2](https://github.com/anyup/uView-Pro/commit/e8918e28a413d861e05a213d49f9a1b39af17964))
10
+ - **u-radio:** u-radio,u-radio-group支持small/default/large预设尺寸配置(#137) ([51af7f8](https://github.com/anyup/uView-Pro/commit/51af7f8f86eed99ee159738e43d5dc2d5c6747c8))
11
+ - **u-switch:** u-switch支持small/default/large预设尺寸配置(#137) ([6041d52](https://github.com/anyup/uView-Pro/commit/6041d52338172d40957e3ed7af1dde01aa7de074))
12
+ - **u-form:** 新增表单大小配置功能,u-form支持小、中、大三种尺寸设置(#137) ([324adb9](https://github.com/anyup/uView-Pro/commit/324adb99de9dfbb72a0a0c40748c11323d3b9470))
13
+ - **u-tag:** 为深色模式标签添加边框样式,保持统一性 ([84d0ad6](https://github.com/anyup/uView-Pro/commit/84d0ad6c805d570e216beaa2dc586687a5aae848))
8
14
 
9
- ### Features | 新功能
15
+ ### ♻️ Code Refactoring | 代码重构
16
+
17
+ - 添加调试模式配置并重构日志系统 ([a52a3f7](https://github.com/anyup/uView-Pro/commit/a52a3f7d6be7d8332a67c1d8458f4e65e0a0204e))
18
+ - **props:** 移除baseProps公共属性并内联到各组件,修复uni_modules引入方式在微信小程序正式打包运行报错的问题 ([f30f779](https://github.com/anyup/uView-Pro/commit/f30f7792a48679afc3cf705a5eb0b182591fe9b5))
19
+ - **form:** 调整表单大小配置位置 ([45ffecd](https://github.com/anyup/uView-Pro/commit/45ffecd3522df85cdaaa62ecb9c33d7839443586))
10
20
 
11
- - **types:** 添加昵称输入类型支持 ([bd15170](https://github.com/anyup/uView-Pro/commit/bd15170d0ccc76098debb9e37b4acfbe43fef043))
21
+ ### 🐛 Bug Fixes | Bug 修复
22
+
23
+ - **useChildren:** 修复组件关系工具子组件ID缓存问题,避免同组件多次调用useChildren时重复注册 ([3a8c659](https://github.com/anyup/uView-Pro/commit/3a8c659ce596b483559cf4b061d0b54d784a902b))
24
+ - **u-form:** 修复移除字段时方法不存在的错误 ([58ada99](https://github.com/anyup/uView-Pro/commit/58ada99a8cbd44874eebfd305a4aeb721add8558))
12
25
 
13
26
  ### 👥 Contributors
14
27
 
15
- <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/xaunseus"><img src="https://github.com/xaunseus.png?size=40" width="40" height="40" alt="xaunseus" title="xaunseus"/></a>
28
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
16
29
 
30
+ ## 0.5.15(2026-03-25)
31
+
32
+ ### 🐛 Bug Fixes | Bug 修复
33
+
34
+ - **u-form:** 修复表单项底部边框默认值逻辑 ([d939fbd](https://github.com/anyup/uView-Pro/commit/d939fbd5df85c266f8a8f5e23ebeca251eee94ec))
35
+ - **u-input:** 修复u-input输入框在某些微信小程序平台下,重新获取焦点时会清空输入框的问题 ([cedecfa](https://github.com/anyup/uView-Pro/commit/cedecfa4bf2142046bb512b1d9e87f6c9d77516d))
36
+ - **demo:** 优化微信小程序首页u-sticky使用配置 ([cc4e9ac](https://github.com/anyup/uView-Pro/commit/cc4e9ac9f022e7713b2eb2746038a8481729c0b4))
37
+
38
+ ### ✨ Features | 新功能
39
+
40
+ - **types:** 添加昵称输入类型支持 ([bd15170](https://github.com/anyup/uView-Pro/commit/bd15170d0ccc76098debb9e37b4acfbe43fef043))
41
+
42
+ ### 👥 Contributors
43
+
44
+ <a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a> <a href="https://github.com/xaunseus"><img src="https://github.com/xaunseus.png?size=40" width="40" height="40" alt="xaunseus" title="xaunseus"/></a>
45
+
17
46
  ## 0.5.14(2026-03-23)
18
47
 
19
48
  ### 🐛 Bug Fixes | Bug 修复
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { ActionSheetItem, ActionSheetTips } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
  import { getColor, useLocale } from '../../';
5
4
 
6
5
  const { t } = useLocale();
@@ -10,7 +9,16 @@ const { t } = useLocale();
10
9
  * @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。
11
10
  */
12
11
  export const ActionSheetProps = {
13
- ...baseProps,
12
+ /** 自定义根节点样式 */
13
+ customStyle: {
14
+ type: [String, Object] as PropType<string | Record<string, any>>,
15
+ default: () => ({})
16
+ },
17
+ /** 自定义根节点样式类 */
18
+ customClass: {
19
+ type: String as unknown as PropType<string>,
20
+ default: ''
21
+ },
14
22
  /** 点击遮罩是否可以关闭actionSheet */
15
23
  maskCloseAble: { type: Boolean, default: true },
16
24
  /** 按钮的文字数组,可以自定义颜色和字体大小,字体单位为rpx */
@@ -1,5 +1,4 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
- import { baseProps } from '../common/props';
3
2
  import { getColor } from '../../';
4
3
 
5
4
  /**
@@ -7,7 +6,16 @@ import { getColor } from '../../';
7
6
  * @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。
8
7
  */
9
8
  export const ActionSheetItemProps = {
10
- ...baseProps,
9
+ /** 自定义根节点样式 */
10
+ customStyle: {
11
+ type: [String, Object] as PropType<string | Record<string, any>>,
12
+ default: () => ({})
13
+ },
14
+ /** 自定义根节点样式类 */
15
+ customClass: {
16
+ type: String as unknown as PropType<string>,
17
+ default: ''
18
+ },
11
19
  /** 标题 */
12
20
  text: { type: String, default: '' },
13
21
  /** 描述 */
@@ -1,13 +1,21 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { ThemeType } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
 
5
4
  /**
6
5
  * alertTips 警告提示
7
6
  * @description 警告提示,展现需要关注的信息
8
7
  */
9
8
  export const AlertTipsProps = {
10
- ...baseProps,
9
+ /** 自定义根节点样式 */
10
+ customStyle: {
11
+ type: [String, Object] as PropType<string | Record<string, any>>,
12
+ default: () => ({})
13
+ },
14
+ /** 自定义根节点样式类 */
15
+ customClass: {
16
+ type: String as unknown as PropType<string>,
17
+ default: ''
18
+ },
11
19
  /** 显示文字 */
12
20
  title: { type: String, default: '' },
13
21
  /** 主题,success/warning/info/error */
@@ -1,10 +1,18 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { ImgMode } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
 
5
4
  // u-avatar 组件 props
6
5
  export const AvatarProps = {
7
- ...baseProps,
6
+ /** 自定义根节点样式 */
7
+ customStyle: {
8
+ type: [String, Object] as PropType<string | Record<string, any>>,
9
+ default: () => ({})
10
+ },
11
+ /** 自定义根节点样式类 */
12
+ customClass: {
13
+ type: String as unknown as PropType<string>,
14
+ default: ''
15
+ },
8
16
  /** 背景颜色 */
9
17
  bgColor: { type: String, default: 'transparent' },
10
18
  /** 头像路径 */
@@ -1,10 +1,18 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { Shape } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
 
5
4
  // u-back-top 组件 props
6
5
  export const BackTopProps = {
7
- ...baseProps,
6
+ /** 自定义根节点样式 */
7
+ customStyle: {
8
+ type: [String, Object] as PropType<string | Record<string, any>>,
9
+ default: () => ({})
10
+ },
11
+ /** 自定义根节点样式类 */
12
+ customClass: {
13
+ type: String as unknown as PropType<string>,
14
+ default: ''
15
+ },
8
16
  /** 返回顶部的形状,circle-圆形,square-方形 */
9
17
  mode: { type: String as PropType<Shape>, default: 'circle' },
10
18
  /** 自定义图标 */
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { BadgeSize, ThemeType } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
 
5
4
  /**
6
5
  * badge 角标类型定义
@@ -8,7 +7,16 @@ import { baseProps } from '../common/props';
8
7
  */
9
8
 
10
9
  export const BadgeProps = {
11
- ...baseProps,
10
+ /** 自定义根节点样式 */
11
+ customStyle: {
12
+ type: [String, Object] as PropType<string | Record<string, any>>,
13
+ default: () => ({})
14
+ },
15
+ /** 自定义根节点样式类 */
16
+ customClass: {
17
+ type: String as unknown as PropType<string>,
18
+ default: ''
19
+ },
12
20
  /** 使用预设的背景颜色 primary,warning,success,error,info */
13
21
  type: { type: String as PropType<ThemeType>, default: 'error' },
14
22
  /** Badge的尺寸,default, mini */
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { ButtonFormType, ButtonOpenType, ButtonScope, ButtonSize, ButtonType, Shape } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
 
5
4
  /**
6
5
  * button 按钮类型定义
@@ -8,14 +7,23 @@ import { baseProps } from '../common/props';
8
7
  */
9
8
 
10
9
  export const ButtonProps = {
11
- ...baseProps,
10
+ /** 自定义根节点样式 */
11
+ customStyle: {
12
+ type: [String, Object] as PropType<string | Record<string, any>>,
13
+ default: () => ({})
14
+ },
15
+ /** 自定义根节点样式类 */
16
+ customClass: {
17
+ type: String as unknown as PropType<string>,
18
+ default: ''
19
+ },
12
20
  /** 按钮文本 */
13
21
  text: { type: String, default: '' },
14
22
  /** 是否细边框 */
15
23
  hairLine: { type: Boolean, default: true },
16
24
  /** 按钮的预置样式,default,primary,error,warning,success */
17
25
  type: { type: String as PropType<ButtonType>, default: 'default' },
18
- /** 按钮尺寸,default,medium,mini */
26
+ /** 按钮尺寸,default,large, medium=small,mini */
19
27
  size: { type: String as PropType<ButtonSize>, default: 'default' },
20
28
  /** 按钮形状,circle(两边为半圆),square(带圆角) */
21
29
  shape: { type: String as PropType<Shape>, default: 'square' },
@@ -498,6 +498,12 @@ function agreeprivacyauthorization(event: any) {
498
498
  background-color: hsla(0, 0%, 100%, 0.35);
499
499
  }
500
500
 
501
+ .u-size-large {
502
+ font-size: 36rpx;
503
+ height: 100rpx;
504
+ line-height: 100rpx;
505
+ }
506
+
501
507
  .u-size-default {
502
508
  font-size: 30rpx;
503
509
  height: 80rpx;
@@ -515,6 +521,17 @@ function agreeprivacyauthorization(event: any) {
515
521
  padding: 0 80rpx;
516
522
  }
517
523
 
524
+ .u-size-small {
525
+ /* #ifndef APP-NVUE */
526
+ display: inline-flex;
527
+ /* #endif */
528
+ width: auto;
529
+ font-size: 24rpx;
530
+ height: 60rpx;
531
+ line-height: 60rpx;
532
+ padding: 0 30rpx;
533
+ }
534
+
518
535
  .u-size-mini {
519
536
  /* #ifndef APP-NVUE */
520
537
  display: inline-flex;
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { CalendarChangeDate, CalendarChangeRange, CalendarMode, ThemeType } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
  import { getColor, useLocale } from '../../';
5
4
 
6
5
  const { t } = useLocale();
@@ -10,7 +9,16 @@ const { t } = useLocale();
10
9
  * @description 供 u-calendar 组件 props 使用
11
10
  */
12
11
  export const CalendarProps = {
13
- ...baseProps,
12
+ /** 自定义根节点样式 */
13
+ customStyle: {
14
+ type: [String, Object] as PropType<string | Record<string, any>>,
15
+ default: () => ({})
16
+ },
17
+ /** 自定义根节点样式类 */
18
+ customClass: {
19
+ type: String as unknown as PropType<string>,
20
+ default: ''
21
+ },
14
22
  /** 是否开启底部安全区适配 */
15
23
  safeAreaInsetBottom: { type: Boolean, default: false },
16
24
  /** 是否允许通过点击遮罩关闭Picker */
@@ -1,12 +1,20 @@
1
- import type { ExtractPropTypes } from 'vue';
2
- import { baseProps } from '../common/props';
1
+ import type { ExtractPropTypes, PropType } from 'vue';
3
2
 
4
3
  /**
5
4
  * u-car-keyboard 车牌号键盘类型定义
6
5
  * @description 供 u-car-keyboard 组件 props 使用
7
6
  */
8
7
  export const CarKeyboardProps = {
9
- ...baseProps,
8
+ /** 自定义根节点样式 */
9
+ customStyle: {
10
+ type: [String, Object] as PropType<string | Record<string, any>>,
11
+ default: () => ({})
12
+ },
13
+ /** 自定义根节点样式类 */
14
+ customClass: {
15
+ type: String as unknown as PropType<string>,
16
+ default: ''
17
+ },
10
18
  /** 是否打乱键盘按键的顺序 */
11
19
  random: { type: Boolean, default: false }
12
20
  };
@@ -1,5 +1,4 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
- import { baseProps } from '../common/props';
3
2
 
4
3
  /**
5
4
  * card 卡片类型定义
@@ -9,7 +8,16 @@ export type CardIndex = string | number | Record<string, any>;
9
8
  export type CardStyle = Record<string, any>;
10
9
 
11
10
  export const CardProps = {
12
- ...baseProps,
11
+ /** 自定义根节点样式 */
12
+ customStyle: {
13
+ type: [String, Object] as PropType<string | Record<string, any>>,
14
+ default: () => ({})
15
+ },
16
+ /** 自定义根节点样式类 */
17
+ customClass: {
18
+ type: String as unknown as PropType<string>,
19
+ default: ''
20
+ },
13
21
  /** 与屏幕两侧是否留空隙 */
14
22
  full: { type: Boolean, default: false },
15
23
  /** 标题 */
@@ -1,5 +1,4 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
- import { baseProps } from '../common/props';
3
2
 
4
3
  /**
5
4
  * cell-group 组件 props 类型定义
@@ -7,7 +6,16 @@ import { baseProps } from '../common/props';
7
6
  */
8
7
 
9
8
  export const CellGroupProps = {
10
- ...baseProps,
9
+ /** 自定义根节点样式 */
10
+ customStyle: {
11
+ type: [String, Object] as PropType<string | Record<string, any>>,
12
+ default: () => ({})
13
+ },
14
+ /** 自定义根节点样式类 */
15
+ customClass: {
16
+ type: String as unknown as PropType<string>,
17
+ default: ''
18
+ },
11
19
  /** 分组标题 */
12
20
  title: { type: String, default: '' },
13
21
  /** 是否显示分组list上下边框 */
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { CellItemArrowDirection } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
 
5
4
  /**
6
5
  * cell-item 组件 props 类型定义
@@ -10,7 +9,16 @@ export type CellItemIndex = string | number;
10
9
  export type CellItemStyle = Record<string, any>;
11
10
 
12
11
  export const CellItemProps = {
13
- ...baseProps,
12
+ /** 自定义根节点样式 */
13
+ customStyle: {
14
+ type: [String, Object] as PropType<string | Record<string, any>>,
15
+ default: () => ({})
16
+ },
17
+ /** 自定义根节点样式类 */
18
+ customClass: {
19
+ type: String as unknown as PropType<string>,
20
+ default: ''
21
+ },
14
22
  /** 左侧图标名称(只能uView内置图标),或者图标src */
15
23
  icon: { type: String, default: '' },
16
24
  /** 左侧标题 */
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
- import type { Shape } from '../../types/global';
3
- import { baseProps } from '../common/props';
2
+ import type { Shape, SizeType } from '../../types/global';
4
3
 
5
4
  /**
6
5
  * checkbox 复选框类型定义
@@ -9,7 +8,16 @@ import { baseProps } from '../common/props';
9
8
  export type CheckboxValue = string | number | boolean;
10
9
 
11
10
  export const CheckboxProps = {
12
- ...baseProps,
11
+ /** 自定义根节点样式 */
12
+ customStyle: {
13
+ type: [String, Object] as PropType<string | Record<string, any>>,
14
+ default: () => ({})
15
+ },
16
+ /** 自定义根节点样式类 */
17
+ customClass: {
18
+ type: String as unknown as PropType<string>,
19
+ default: ''
20
+ },
13
21
  /** checkbox的标签 */
14
22
  label: { type: String, default: '' },
15
23
  /** checkbox的值 */
@@ -31,7 +39,7 @@ export const CheckboxProps = {
31
39
  /** label的字体大小,rpx单位 */
32
40
  labelSize: { type: [String, Number], default: '' },
33
41
  /** 组件的整体大小 */
34
- size: { type: [String, Number], default: '' }
42
+ size: { type: [String, Number] as PropType<SizeType | string | number>, default: '' }
35
43
  };
36
44
 
37
45
  export type CheckboxProps = ExtractPropTypes<typeof CheckboxProps>;
@@ -2,7 +2,7 @@
2
2
  <view class="u-checkbox" :style="$u.toStyle(checkboxStyle, customStyle)" :class="customClass">
3
3
  <view class="u-checkbox__icon-wrap" @tap="toggle" :class="iconClass" :style="$u.toStyle(iconStyle)">
4
4
  <u-icon
5
- class="u-checkbox__icon-wrap__icon"
5
+ custom-class="u-checkbox__icon-wrap__icon"
6
6
  name="checkbox-mark"
7
7
  :size="checkboxIconSize"
8
8
  :color="iconColor"
@@ -12,7 +12,7 @@
12
12
  class="u-checkbox__label"
13
13
  @tap="onClickLabel"
14
14
  :style="{
15
- fontSize: $u.addUnit(labelSize)
15
+ fontSize: labelFontSize
16
16
  }"
17
17
  >
18
18
  <slot>
@@ -39,6 +39,7 @@ export default {
39
39
  import { computed, ref, watch } from 'vue';
40
40
  import { $u, useChildren } from '../..';
41
41
  import { CheckboxProps } from './types';
42
+ import type { SizeType } from '../../types/global';
42
43
 
43
44
  /**
44
45
  * checkbox 复选框
@@ -59,6 +60,9 @@ const props = defineProps(CheckboxProps);
59
60
  const emit = defineEmits(['change', 'update:modelValue']);
60
61
  // checkbox 是否选中,true/false
61
62
  const checkedValue = ref(props.modelValue);
63
+ // 使用子组件Hook
64
+ const { parentExposed } = useChildren('u-checkbox', 'u-checkbox-group');
65
+ const { parentExposed: formExposed } = useChildren('u-checkbox', 'u-form');
62
66
 
63
67
  // checkbox 的value值,id
64
68
  const checkboxValue = computed(() => {
@@ -81,8 +85,53 @@ watch(
81
85
  { immediate: true }
82
86
  );
83
87
 
84
- // 使用子组件Hook
85
- const { parentExposed } = useChildren('u-checkbox', 'u-checkbox-group');
88
+ // 根据 size 定义不同的配置
89
+ const sizeConfig = {
90
+ small: {
91
+ size: 28,
92
+ fontSize: 24,
93
+ iconSize: 16
94
+ },
95
+ default: {
96
+ size: 34,
97
+ fontSize: 28,
98
+ iconSize: 20
99
+ },
100
+ large: {
101
+ size: 40,
102
+ fontSize: 32,
103
+ iconSize: 24
104
+ }
105
+ };
106
+
107
+ // 获取实际使用的 size 值(优先级:props.size > u-form.size)
108
+ const actualSize = computed(() => {
109
+ // 优先使用 props 的 size 属性
110
+ if (props.size !== '') {
111
+ return String(props.size);
112
+ }
113
+ // 次优先:使用 u-checkbox-group 的 size 属性
114
+ if (parentExposed.value?.props?.size) {
115
+ return String(parentExposed.value.props.size);
116
+ }
117
+ // 最后:使用 u-form 的 size 属性(u-form 的 size 只支持预设值)
118
+ if (formExposed.value?.props?.size) {
119
+ return String(formExposed.value.props.size);
120
+ }
121
+ // 默认值
122
+ return 'default';
123
+ });
124
+
125
+ // 判断实际使用的 size 是否在预设配置中
126
+ const isInSizeConfig = computed(() => actualSize.value in sizeConfig);
127
+
128
+ // 获取预设 size(用于查找 sizeConfig 配置,如图标大小、高度等)
129
+ const presetSize = computed(() => {
130
+ return (isInSizeConfig.value ? actualSize.value : 'default') as SizeType;
131
+ });
132
+
133
+ // 获取当前尺寸配置
134
+ const currentSizeConfig = computed(() => sizeConfig[presetSize.value]);
86
135
 
87
136
  // 是否禁用,如果父组件u-checkbox-group禁用的话,将会忽略子组件的配置
88
137
  const isDisabled = computed(() => {
@@ -95,13 +144,28 @@ const isLabelDisabled = computed(() => {
95
144
  });
96
145
 
97
146
  // 组件尺寸,对应size的值,默认值为34rpx
98
- const checkboxSize = computed(() => {
99
- return props.size ? props.size : (parentExposed.value?.props?.size ?? 34);
100
- });
147
+ const checkboxSize = computed(() => currentSizeConfig.value.size);
101
148
 
102
- // 组件的勾选图标的尺寸,默认20
149
+ // 组件的勾选图标的尺寸,默认20rpx
103
150
  const checkboxIconSize = computed(() => {
104
- return props.iconSize ? props.iconSize : (parentExposed.value?.props?.iconSize ?? 20);
151
+ if (props.iconSize) {
152
+ return props.iconSize;
153
+ }
154
+ if (parentExposed.value?.props?.iconSize) {
155
+ return parentExposed.value?.props?.iconSize;
156
+ }
157
+ if (isInSizeConfig.value) {
158
+ return currentSizeConfig.value.iconSize;
159
+ }
160
+ return 20;
161
+ });
162
+
163
+ // label字体大小,默认28rpx
164
+ const labelFontSize = computed(() => {
165
+ if (isInSizeConfig.value) {
166
+ return $u.addUnit(currentSizeConfig.value.fontSize);
167
+ }
168
+ return $u.addUnit(props.labelSize);
105
169
  });
106
170
 
107
171
  // 组件选中激活时的颜色
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { Shape } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
  import { getColor } from '../../';
5
4
 
6
5
  /**
@@ -9,7 +8,16 @@ import { getColor } from '../../';
9
8
  */
10
9
 
11
10
  export const CheckboxGroupProps = {
12
- ...baseProps,
11
+ /** 自定义根节点样式 */
12
+ customStyle: {
13
+ type: [String, Object] as PropType<string | Record<string, any>>,
14
+ default: () => ({})
15
+ },
16
+ /** 自定义根节点样式类 */
17
+ customClass: {
18
+ type: String as unknown as PropType<string>,
19
+ default: ''
20
+ },
13
21
  /** 绑定值,选中的复选框name组成的数组 */
14
22
  modelValue: { type: Array as PropType<(string | number)[]>, default: undefined },
15
23
  /** 最多能选中多少个checkbox */
@@ -24,14 +32,14 @@ export const CheckboxGroupProps = {
24
32
  shape: { type: String as PropType<Shape>, default: 'square' },
25
33
  /** 选中状态下的颜色 */
26
34
  activeColor: { type: String, default: () => getColor('primary') },
27
- /** 组件的整体大小 */
28
- size: { type: [String, Number], default: 34 },
35
+ /** 组件的整体大小,单位rpx,默认34rpx */
36
+ size: { type: [String, Number], default: '' },
29
37
  /** 每个checkbox占u-checkbox-group的宽度 */
30
38
  width: { type: String, default: 'auto' },
31
39
  /** 是否每个checkbox都换行 */
32
40
  wrap: { type: Boolean, default: false },
33
- /** 图标的大小,单位rpx */
34
- iconSize: { type: [String, Number], default: 20 }
41
+ /** 图标的大小,单位rpx,默认20rpx */
42
+ iconSize: { type: [String, Number], default: '' }
35
43
  };
36
44
 
37
45
  export type CheckboxGroupProps = ExtractPropTypes<typeof CheckboxGroupProps>;
@@ -18,7 +18,7 @@ export default {
18
18
  </script>
19
19
 
20
20
  <script setup lang="ts">
21
- import { getCurrentInstance, computed, watch, nextTick, onMounted } from 'vue';
21
+ import { computed, watch, nextTick, onMounted } from 'vue';
22
22
  import { $u, useParent, useChildren, useDebounce } from '../..';
23
23
  import { CheckboxGroupProps } from './types';
24
24
 
@@ -1,6 +1,5 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
2
  import type { ThemeType } from '../../types/global';
3
- import { baseProps } from '../common/props';
4
3
  import { $u } from '../../libs';
5
4
 
6
5
  /**
@@ -8,7 +7,16 @@ import { $u } from '../../libs';
8
7
  * @description 展示操作或任务的当前进度,比如上传文件,是一个圆形的进度条。注意:此组件的percent值只能动态增加,不能动态减少。
9
8
  */
10
9
  export const CircleProgressProps = {
11
- ...baseProps,
10
+ /** 自定义根节点样式 */
11
+ customStyle: {
12
+ type: [String, Object] as PropType<string | Record<string, any>>,
13
+ default: () => ({})
14
+ },
15
+ /** 自定义根节点样式类 */
16
+ customClass: {
17
+ type: String as unknown as PropType<string>,
18
+ default: ''
19
+ },
12
20
  /** 圆环进度百分比值 */
13
21
  percent: {
14
22
  type: Number,
@@ -1,12 +1,20 @@
1
1
  import type { ExtractPropTypes, PropType } from 'vue';
2
- import { baseProps } from '../common/props';
3
2
 
4
3
  /**
5
4
  * u-city-select 城市选择器 Props
6
5
  * @description 用于选择省、市、区三级行政区域,支持回显和自定义初始值。
7
6
  */
8
7
  export const CitySelectProps = {
9
- ...baseProps,
8
+ /** 自定义根节点样式 */
9
+ customStyle: {
10
+ type: [String, Object] as PropType<string | Record<string, any>>,
11
+ default: () => ({})
12
+ },
13
+ /** 自定义根节点样式类 */
14
+ customClass: {
15
+ type: String as unknown as PropType<string>,
16
+ default: ''
17
+ },
10
18
  /** 控制弹窗显示与隐藏(v-model) */
11
19
  modelValue: { type: Boolean, default: false },
12
20
  /** 默认选中的省市区名称数组 */