uview-pro 0.2.4 → 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 (162) hide show
  1. package/changelog.md +29 -0
  2. package/components/u-action-sheet/types.ts +2 -0
  3. package/components/u-action-sheet/u-action-sheet.vue +15 -4
  4. package/components/u-alert-tips/types.ts +2 -0
  5. package/components/u-alert-tips/u-alert-tips.vue +24 -9
  6. package/components/u-avatar/types.ts +2 -0
  7. package/components/u-avatar/u-avatar.vue +15 -5
  8. package/components/u-avatar-cropper/u-avatar-cropper.vue +13 -2
  9. package/components/u-back-top/types.ts +2 -5
  10. package/components/u-back-top/u-back-top.vue +27 -15
  11. package/components/u-badge/types.ts +2 -0
  12. package/components/u-badge/u-badge.vue +33 -15
  13. package/components/u-button/types.ts +2 -2
  14. package/components/u-button/u-button.vue +23 -10
  15. package/components/u-car-keyboard/types.ts +2 -0
  16. package/components/u-car-keyboard/u-car-keyboard.vue +14 -5
  17. package/components/u-card/types.ts +2 -0
  18. package/components/u-card/u-card.vue +25 -10
  19. package/components/u-cell-group/types.ts +2 -0
  20. package/components/u-cell-group/u-cell-group.vue +15 -5
  21. package/components/u-cell-item/types.ts +2 -0
  22. package/components/u-cell-item/u-cell-item.vue +24 -11
  23. package/components/u-checkbox/types.ts +2 -0
  24. package/components/u-checkbox/u-checkbox.vue +12 -13
  25. package/components/u-checkbox-group/types.ts +2 -0
  26. package/components/u-checkbox-group/u-checkbox-group.vue +1 -1
  27. package/components/u-circle-progress/types.ts +2 -0
  28. package/components/u-circle-progress/u-circle-progress.vue +24 -9
  29. package/components/u-city-select/types.ts +2 -0
  30. package/components/u-city-select/u-city-select.vue +16 -4
  31. package/components/u-col/types.ts +2 -0
  32. package/components/u-col/u-col.vue +27 -8
  33. package/components/u-collapse/u-collapse.vue +8 -4
  34. package/components/u-collapse-item/u-collapse-item.vue +32 -27
  35. package/components/u-column-notice/types.ts +2 -0
  36. package/components/u-column-notice/u-column-notice.vue +16 -4
  37. package/components/u-count-down/types.ts +2 -0
  38. package/components/u-count-down/u-count-down.vue +20 -8
  39. package/components/u-count-to/types.ts +2 -0
  40. package/components/u-count-to/u-count-to.vue +25 -7
  41. package/components/u-divider/types.ts +2 -0
  42. package/components/u-divider/u-divider.vue +26 -10
  43. package/components/u-dropdown/types.ts +2 -0
  44. package/components/u-dropdown/u-dropdown.vue +48 -20
  45. package/components/u-dropdown-item/types.ts +2 -0
  46. package/components/u-dropdown-item/u-dropdown-item.vue +33 -41
  47. package/components/u-empty/types.ts +2 -0
  48. package/components/u-empty/u-empty.vue +20 -5
  49. package/components/u-field/types.ts +2 -0
  50. package/components/u-field/u-field.vue +18 -3
  51. package/components/u-form/types.ts +2 -0
  52. package/components/u-form/u-form.vue +20 -26
  53. package/components/u-form-item/types.ts +2 -0
  54. package/components/u-form-item/u-form-item.vue +67 -67
  55. package/components/u-full-screen/types.ts +2 -0
  56. package/components/u-full-screen/u-full-screen.vue +16 -2
  57. package/components/u-gap/types.ts +2 -0
  58. package/components/u-gap/u-gap.vue +15 -5
  59. package/components/u-grid/types.ts +2 -0
  60. package/components/u-grid/u-grid.vue +23 -25
  61. package/components/u-grid-item/types.ts +3 -3
  62. package/components/u-grid-item/u-grid-item.vue +43 -47
  63. package/components/u-icon/types.ts +0 -1
  64. package/components/u-icon/u-icon.vue +5 -3
  65. package/components/u-image/u-image.vue +13 -4
  66. package/components/u-index-anchor/types.ts +3 -3
  67. package/components/u-index-anchor/u-index-anchor.vue +18 -10
  68. package/components/u-index-list/u-index-list.vue +9 -12
  69. package/components/u-input/types.ts +2 -5
  70. package/components/u-input/u-input.vue +15 -6
  71. package/components/u-keyboard/u-keyboard.vue +13 -4
  72. package/components/u-lazy-load/u-lazy-load.vue +13 -2
  73. package/components/u-line/u-line.vue +13 -4
  74. package/components/u-line-progress/u-line-progress.vue +13 -4
  75. package/components/u-link/u-link.vue +13 -4
  76. package/components/u-loading/u-loading.vue +13 -4
  77. package/components/u-loading-popup/u-loading-popup.vue +14 -0
  78. package/components/u-loadmore/u-loadmore.vue +13 -2
  79. package/components/u-mask/types.ts +2 -5
  80. package/components/u-mask/u-mask.vue +21 -14
  81. package/components/u-message-input/u-message-input.vue +13 -2
  82. package/components/u-modal/u-modal.vue +13 -4
  83. package/components/u-navbar/u-navbar.vue +13 -2
  84. package/components/u-no-network/u-no-network.vue +13 -2
  85. package/components/u-notice-bar/u-notice-bar.vue +13 -3
  86. package/components/u-number-box/u-number-box.vue +13 -4
  87. package/components/u-number-keyboard/u-number-keyboard.vue +13 -4
  88. package/components/u-picker/u-picker.vue +13 -4
  89. package/components/u-popup/types.ts +2 -2
  90. package/components/u-popup/u-popup.vue +15 -5
  91. package/components/u-radio/types.ts +2 -0
  92. package/components/u-radio/u-radio.vue +26 -19
  93. package/components/u-radio-group/types.ts +2 -0
  94. package/components/u-radio-group/u-radio-group.vue +20 -32
  95. package/components/u-rate/types.ts +2 -0
  96. package/components/u-rate/u-rate.vue +20 -5
  97. package/components/u-read-more/types.ts +2 -0
  98. package/components/u-read-more/u-read-more.vue +23 -7
  99. package/components/u-root-portal/u-root-portal.vue +3 -1
  100. package/components/u-row/types.ts +2 -0
  101. package/components/u-row/u-row.vue +29 -11
  102. package/components/u-row-notice/types.ts +2 -0
  103. package/components/u-row-notice/u-row-notice.vue +16 -4
  104. package/components/u-safe-bottom/u-safe-bottom.vue +13 -2
  105. package/components/u-search/types.ts +2 -0
  106. package/components/u-search/u-search.vue +16 -5
  107. package/components/u-section/types.ts +2 -0
  108. package/components/u-section/u-section.vue +31 -12
  109. package/components/u-select/types.ts +2 -0
  110. package/components/u-select/u-select.vue +15 -5
  111. package/components/u-skeleton/types.ts +2 -0
  112. package/components/u-skeleton/u-skeleton.vue +14 -3
  113. package/components/u-slider/types.ts +2 -0
  114. package/components/u-slider/u-slider.vue +27 -19
  115. package/components/u-status-bar/u-status-bar.vue +13 -4
  116. package/components/u-steps/types.ts +2 -0
  117. package/components/u-steps/u-steps.vue +15 -3
  118. package/components/u-sticky/types.ts +2 -0
  119. package/components/u-sticky/u-sticky.vue +23 -7
  120. package/components/u-subsection/types.ts +2 -0
  121. package/components/u-subsection/u-subsection.vue +14 -3
  122. package/components/u-swipe-action/types.ts +2 -0
  123. package/components/u-swipe-action/u-swipe-action.vue +19 -3
  124. package/components/u-swiper/types.ts +2 -0
  125. package/components/u-swiper/u-swiper.vue +19 -2
  126. package/components/u-switch/types.ts +2 -0
  127. package/components/u-switch/u-switch.vue +15 -6
  128. package/components/u-tabbar/types.ts +2 -0
  129. package/components/u-tabbar/u-tabbar.vue +20 -3
  130. package/components/u-table/types.ts +2 -0
  131. package/components/u-table/u-table.vue +15 -3
  132. package/components/u-tabs/types.ts +2 -0
  133. package/components/u-tabs/u-tabs.vue +14 -3
  134. package/components/u-tabs-swiper/types.ts +2 -0
  135. package/components/u-tabs-swiper/u-tabs-swiper.vue +15 -3
  136. package/components/u-tag/types.ts +2 -0
  137. package/components/u-tag/u-tag.vue +22 -6
  138. package/components/u-td/types.ts +2 -0
  139. package/components/u-td/u-td.vue +14 -3
  140. package/components/u-text/u-text.vue +4 -2
  141. package/components/u-th/types.ts +2 -0
  142. package/components/u-th/u-th.vue +14 -3
  143. package/components/u-time-line/u-time-line.vue +17 -3
  144. package/components/u-time-line-item/types.ts +2 -0
  145. package/components/u-time-line-item/u-time-line-item.vue +15 -3
  146. package/components/u-toast/types.ts +2 -0
  147. package/components/u-toast/u-toast.vue +15 -8
  148. package/components/u-top-tips/types.ts +2 -0
  149. package/components/u-top-tips/u-top-tips.vue +20 -3
  150. package/components/u-tr/types.ts +4 -1
  151. package/components/u-tr/u-tr.vue +17 -2
  152. package/components/u-upload/types.ts +2 -0
  153. package/components/u-upload/u-upload.vue +14 -5
  154. package/components/u-verification-code/types.ts +2 -0
  155. package/components/u-verification-code/u-verification-code.vue +15 -3
  156. package/components/u-waterfall/types.ts +2 -0
  157. package/components/u-waterfall/u-waterfall.vue +15 -3
  158. package/libs/hooks/index.ts +2 -1
  159. package/libs/hooks/useCompRelation.ts +364 -0
  160. package/libs/index.ts +56 -39
  161. package/package.json +1 -1
  162. package/readme.md +6 -6
package/changelog.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## 0.3.0(2025-10-12)
2
+
3
+ ### 📝 Documentation | 文档
4
+
5
+ - 更新开源捐赠图片 ([8eb0f00](https://github.com/anyup/uView-Pro/commit/8eb0f00ed5308cd1c3574b66dc752b050bbfcb70))
6
+ - update readme ([c93cdcb](https://github.com/anyup/uView-Pro/commit/c93cdcb1278040b8c5b6232b0d7928edad22af5d))
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ - **component-relation:** 添加组件关系管理 Hooks 工具,用于完全替换 provide/inject,全平台兼容 ([927be95](https://github.com/anyup/uView-Pro/commit/927be95e8b1c1bd5e05cf91c00888c314f6431e8))
11
+
12
+ ### ♻️ Code Refactoring | 代码重构
13
+
14
+ - **components:** 重构复选框checkbox和手风琴collapse组件,使用新版组件关系管理工具,优化兼容性 ([a6b2e86](https://github.com/anyup/uView-Pro/commit/a6b2e86394193a1ff5b58df045cba5518b322d38))
15
+ - **u-radio:** 修复单选框组件,兼容微信、头条小程序 ([6c409dc](https://github.com/anyup/uView-Pro/commit/6c409dc2c0ed116abcdde23a366c7f575fd56a24))
16
+ - **styles:** 优化 u-collapse-item 和 u-text 组件的样式合并逻辑 ([d4436c5](https://github.com/anyup/uView-Pro/commit/d4436c51dc2ddb27d70eeba4cad804504da40013))
17
+ - **layout:** 优化布局组件兼容性 ([285b7a7](https://github.com/anyup/uView-Pro/commit/285b7a73fcd9f8a21521be0d7e7a83690495dc4b))
18
+ - **u-form:** 重构表单组件的错误处理和样式,增强兼容性,支持多种小程序平台 ([587f87d](https://github.com/anyup/uView-Pro/commit/587f87d1b8d3dd6cd98e583b2640bef61bd8f119))
19
+ - **components:** 所有组件允许接受外部样式,允许样式穿透 ([e736e90](https://github.com/anyup/uView-Pro/commit/e736e9014e36c995ba434a56a6ccfee01c56ad35))
20
+ - **u-grid:** 重构宫格组件,支持自定义样式 ([d999ece](https://github.com/anyup/uView-Pro/commit/d999eceed2447ddc99a62a6bdcc57deaa1d1b515))
21
+ - **component-relation:** 优化子组件挂载时连接父组件的逻辑 ([2d038f2](https://github.com/anyup/uView-Pro/commit/2d038f2721e91db2f1773079341473505f2f6836))
22
+ - **u-dropdown:** 重构下拉菜单组件,兼容多平台 ([393caa5](https://github.com/anyup/uView-Pro/commit/393caa57910e9a63484e0c9e852c634fc15ef606))
23
+ - **components:** 优化部分组件中的 customStyle 属性及样式处理 ([3506a5a](https://github.com/anyup/uView-Pro/commit/3506a5a055a7a106311351b4b8b90127b019a061))
24
+ - **components:** 统一使用 customClass 和 customStyle 属性,统一处理组件样式和类名 ([d400997](https://github.com/anyup/uView-Pro/commit/d40099782b97011edc04c5040342b585b8f18fcd))
25
+
26
+ ### 🐛 Bug Fixes | Bug 修复
27
+
28
+ - **u-collapse:** 修复手风琴模式和非手风琴模式的处理回调时,index错误的问题 ([a5882eb](https://github.com/anyup/uView-Pro/commit/a5882eb17d87fee4e06448ecc353bf4237f25d52))
29
+
1
30
  ## 0.2.4(2025-10-08)
2
31
 
3
32
  ### 🐛 Bug Fixes | Bug 修复
@@ -1,11 +1,13 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { ActionSheetItem, ActionSheetTips } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  /**
5
6
  * actionSheet 操作菜单
6
7
  * @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。
7
8
  */
8
9
  export const ActionSheetProps = {
10
+ ...baseProps,
9
11
  /** 点击遮罩是否可以关闭actionsheet */
10
12
  maskCloseAble: { type: Boolean, default: true },
11
13
  /** 按钮的文字数组,可以自定义颜色和字体大小,字体单位为rpx */
@@ -9,6 +9,8 @@
9
9
  :safeAreaInsetBottom="safeAreaInsetBottom"
10
10
  @close="popupClose"
11
11
  :z-index="uZIndex"
12
+ :custom-class="customClass"
13
+ :custom-style="customStyle"
12
14
  >
13
15
  <view class="u-tips u-border-bottom" v-if="tips.text" :style="[tipsStyle]">
14
16
  {{ tips.text }}
@@ -40,15 +42,24 @@
40
42
  </u-popup>
41
43
  </template>
42
44
 
45
+ <script lang="ts">
46
+ export default {
47
+ name: 'u-action-sheet',
48
+ options: {
49
+ addGlobalClass: true,
50
+ // #ifndef MP-TOUTIAO
51
+ virtualHost: true,
52
+ // #endif
53
+ styleIsolation: 'shared'
54
+ }
55
+ };
56
+ </script>
57
+
43
58
  <script setup lang="ts">
44
59
  import { computed } from 'vue';
45
60
  import { $u } from '../..';
46
61
  import { ActionSheetProps } from './types';
47
62
 
48
- defineOptions({
49
- name: 'u-action-sheet'
50
- });
51
-
52
63
  /**
53
64
  * actionSheet 操作菜单
54
65
  * @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。
@@ -1,11 +1,13 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { ThemeType } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  /**
5
6
  * alertTips 警告提示
6
7
  * @description 警告提示,展现需要关注的信息
7
8
  */
8
9
  export const AlertTipsProps = {
10
+ ...baseProps,
9
11
  /** 显示文字 */
10
12
  title: { type: String, default: '' },
11
13
  /** 主题,success/warning/info/error */
@@ -5,12 +5,18 @@
5
5
  :class="[
6
6
  !show ? 'u-close-alert-tips' : '',
7
7
  type ? 'u-alert-tips--bg--' + type + '-light' : '',
8
- type ? 'u-alert-tips--border--' + type + '-disabled' : ''
8
+ type ? 'u-alert-tips--border--' + type + '-disabled' : '',
9
+ customClass
9
10
  ]"
10
- :style="{
11
- backgroundColor: bgColor,
12
- borderColor: borderColor
13
- }"
11
+ :style="
12
+ $u.toStyle(
13
+ {
14
+ backgroundColor: bgColor,
15
+ borderColor: borderColor
16
+ },
17
+ customStyle
18
+ )
19
+ "
14
20
  >
15
21
  <view class="u-icon-wrap">
16
22
  <u-icon
@@ -55,16 +61,25 @@
55
61
  </view>
56
62
  </template>
57
63
 
64
+ <script lang="ts">
65
+ export default {
66
+ name: 'u-alert-tips',
67
+ options: {
68
+ addGlobalClass: true,
69
+ // #ifndef MP-TOUTIAO
70
+ virtualHost: true,
71
+ // #endif
72
+ styleIsolation: 'shared'
73
+ }
74
+ };
75
+ </script>
76
+
58
77
  <script setup lang="ts">
59
78
  import uIcon from '../u-icon/u-icon.vue';
60
79
  import { computed } from 'vue';
61
80
  import { $u } from '../..';
62
81
  import { AlertTipsProps } from './types';
63
82
 
64
- defineOptions({
65
- name: 'u-alert-tips'
66
- });
67
-
68
83
  /**
69
84
  * alertTips 警告提示
70
85
  * @description 警告提示,展现需要关注的信息
@@ -1,8 +1,10 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { ImgMode } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  // u-avatar 组件 props
5
6
  export const AvatarProps = {
7
+ ...baseProps,
6
8
  /** 背景颜色 */
7
9
  bgColor: { type: String, default: 'transparent' },
8
10
  /** 头像路径 */
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="u-avatar" :style="wrapStyle" @tap="onClick">
2
+ <view class="u-avatar" :class="customClass" :style="$u.toStyle(wrapStyle, customStyle)" @tap="onClick">
3
3
  <image
4
4
  @error="onLoadError"
5
5
  :style="imgStyle"
@@ -19,13 +19,23 @@
19
19
  </view>
20
20
  </template>
21
21
 
22
+ <script lang="ts">
23
+ export default {
24
+ name: 'u-avatar',
25
+ options: {
26
+ addGlobalClass: true,
27
+ // #ifndef MP-TOUTIAO
28
+ virtualHost: true,
29
+ // #endif
30
+ styleIsolation: 'shared'
31
+ }
32
+ };
33
+ </script>
34
+
22
35
  <script setup lang="ts">
23
36
  import { ref, computed, watch } from 'vue';
24
37
  import { AvatarProps } from './types';
25
-
26
- defineOptions({
27
- name: 'u-avatar'
28
- });
38
+ import { $u } from '../..';
29
39
 
30
40
  let base64Avatar =
31
41
  'data:image/jpg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QMraHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzYgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjREMEQwRkY0RjgwNDExRUE5OTY2RDgxODY3NkJFODMxIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjREMEQwRkY1RjgwNDExRUE5OTY2RDgxODY3NkJFODMxIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NEQwRDBGRjJGODA0MTFFQTk5NjZEODE4Njc2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UUrOQ9FpC4/UwK6aaqtU+DAAAAAAAAAAAAAAA4lKMIuUmoxWrb4ARNx3R3q2rLpa4Sl0y/YCcAAAAAAAAAAANmFud7G8r89r6X0dgFvGzLGRGtuWvTF6NAdwAAAAAAAAAAAy5W442PVN+K59EePp5ARMvOv5MvO6QXCC4AZwAAAAAAAAAAAAAcxlKLUotprg1owN+PvORborq+7Hnwl3gUbO74VzRydt8pKn68ANcJwmqwkpLmnUDkAAAAfNy9atqtyagut0AxXt5xIV8Fbj6lRd7Am5G65V6qUvtwfyx94GMAAAAAAAAAAAAAAAAAAAOU2nVOj5gdsc3LiqRvTpyqwOxbnnrhdfpSfrQB7pnv/AGvuS9gHXPMy5/Fem1yq0v0A6W29XqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//Z';
@@ -37,6 +37,19 @@
37
37
  </view>
38
38
  </template>
39
39
 
40
+ <script lang="ts">
41
+ export default {
42
+ name: 'u-avatar-cropper',
43
+ options: {
44
+ addGlobalClass: true,
45
+ // #ifndef MP-TOUTIAO
46
+ virtualHost: true,
47
+ // #endif
48
+ styleIsolation: 'shared'
49
+ }
50
+ };
51
+ </script>
52
+
40
53
  <script setup lang="ts">
41
54
  // @ts-nocheck
42
55
  import { ref, reactive, onMounted } from 'vue';
@@ -45,8 +58,6 @@ import { $u } from '../..';
45
58
  import WeCropper from './weCropper';
46
59
  import { AvatarCropperProps } from './types';
47
60
 
48
- defineOptions({ name: 'u-avatar-cropper' });
49
-
50
61
  /**
51
62
  * 裁剪矩形框的样式,其中可包含的属性为lineWidth-边框宽度(单位rpx),color: 边框颜色,
52
63
  * mask-遮罩颜色,一般设置为一个rgba的透明度,如"rgba(0, 0, 0, 0.35)"
@@ -1,8 +1,10 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { Shape } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  // u-back-top 组件 props
5
6
  export const BackTopProps = {
7
+ ...baseProps,
6
8
  /** 返回顶部的形状,circle-圆形,square-方形 */
7
9
  mode: { type: String as PropType<Shape>, default: 'circle' },
8
10
  /** 自定义图标 */
@@ -28,11 +30,6 @@ export const BackTopProps = {
28
30
  color: '#909399',
29
31
  fontSize: '38rpx'
30
32
  })
31
- },
32
- /** 整个组件的样式 */
33
- customStyle: {
34
- type: Object as PropType<Record<string, any>>,
35
- default: () => ({})
36
33
  }
37
34
  };
38
35
 
@@ -2,17 +2,19 @@
2
2
  <view
3
3
  @tap="backToTop"
4
4
  class="u-back-top"
5
- :class="['u-back-top--mode--' + mode]"
6
- :style="[
7
- {
8
- bottom: bottom + 'rpx',
9
- right: right + 'rpx',
10
- borderRadius: mode == 'circle' ? '10000rpx' : '8rpx',
11
- zIndex: uZIndex,
12
- opacity: opacity
13
- },
14
- customStyle
15
- ]"
5
+ :class="['u-back-top--mode--' + mode, customClass]"
6
+ :style="
7
+ $u.toStyle(
8
+ {
9
+ bottom: bottom + 'rpx',
10
+ right: right + 'rpx',
11
+ borderRadius: mode == 'circle' ? '10000rpx' : '8rpx',
12
+ zIndex: uZIndex,
13
+ opacity: opacity
14
+ },
15
+ customStyle
16
+ )
17
+ "
16
18
  >
17
19
  <view class="u-back-top__content" v-if="!slots.default">
18
20
  <u-icon @click="backToTop" :name="icon" :custom-style="iconStyle"></u-icon>
@@ -24,13 +26,23 @@
24
26
  </view>
25
27
  </template>
26
28
 
29
+ <script lang="ts">
30
+ export default {
31
+ name: 'u-back-top',
32
+ options: {
33
+ addGlobalClass: true,
34
+ // #ifndef MP-TOUTIAO
35
+ virtualHost: true,
36
+ // #endif
37
+ styleIsolation: 'shared'
38
+ }
39
+ };
40
+ </script>
41
+
27
42
  <script setup lang="ts">
28
43
  import { ref, computed, watch, useSlots } from 'vue';
29
44
  import { BackTopProps } from './types';
30
-
31
- defineOptions({
32
- name: 'u-back-top'
33
- });
45
+ import { $u } from '../../';
34
46
 
35
47
  /**
36
48
  * back-top 返回顶部按钮
@@ -1,5 +1,6 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { BadgeSize, ThemeType } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  /**
5
6
  * badge 角标类型定义
@@ -7,6 +8,7 @@ import type { BadgeSize, ThemeType } from '../../types/global';
7
8
  */
8
9
 
9
10
  export const BadgeProps = {
11
+ ...baseProps,
10
12
  /** 使用预设的背景颜色 primary,warning,success,error,info */
11
13
  type: { type: String as PropType<ThemeType>, default: 'error' },
12
14
  /** Badge的尺寸,default, mini */
@@ -2,30 +2,48 @@
2
2
  <view
3
3
  v-if="show"
4
4
  class="u-badge"
5
- :class="[isDot ? 'u-badge-dot' : '', size === 'mini' ? 'u-badge-mini' : '', type ? 'u-badge--bg--' + type : '']"
6
- :style="[
7
- {
8
- top: (offset as number[])[0] + 'rpx',
9
- right: (offset as number[])[1] + 'rpx',
10
- fontSize: fontSize + 'rpx',
11
- position: absolute ? 'absolute' : 'static',
12
- color: color,
13
- backgroundColor: bgColor
14
- },
15
- boxStyle
5
+ :class="[
6
+ isDot ? 'u-badge-dot' : '',
7
+ size === 'mini' ? 'u-badge-mini' : '',
8
+ type ? 'u-badge--bg--' + type : '',
9
+ customClass
16
10
  ]"
11
+ :style="
12
+ $u.toStyle(
13
+ {
14
+ top: (offset as number[])[0] + 'rpx',
15
+ right: (offset as number[])[1] + 'rpx',
16
+ fontSize: fontSize + 'rpx',
17
+ position: absolute ? 'absolute' : 'static',
18
+ color: color,
19
+ backgroundColor: bgColor
20
+ },
21
+ boxStyle,
22
+ customStyle
23
+ )
24
+ "
17
25
  >
18
26
  {{ showText }}
19
27
  </view>
20
28
  </template>
21
29
 
30
+ <script lang="ts">
31
+ export default {
32
+ name: 'u-badge',
33
+ options: {
34
+ addGlobalClass: true,
35
+ // #ifndef MP-TOUTIAO
36
+ virtualHost: true,
37
+ // #endif
38
+ styleIsolation: 'shared'
39
+ }
40
+ };
41
+ </script>
42
+
22
43
  <script setup lang="ts">
23
44
  import { computed } from 'vue';
24
45
  import { BadgeProps } from './types';
25
-
26
- defineOptions({
27
- name: 'u-badge'
28
- });
46
+ import { $u } from '../..';
29
47
 
30
48
  /**
31
49
  * badge 角标
@@ -1,5 +1,6 @@
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';
3
4
 
4
5
  /**
5
6
  * button 按钮类型定义
@@ -7,6 +8,7 @@ import type { ButtonFormType, ButtonOpenType, ButtonScope, ButtonSize, ButtonTyp
7
8
  */
8
9
 
9
10
  export const ButtonProps = {
11
+ ...baseProps,
10
12
  /** 是否细边框 */
11
13
  hairLine: { type: Boolean, default: true },
12
14
  /** 按钮的预置样式,default,primary,error,warning,success */
@@ -51,8 +53,6 @@ export const ButtonProps = {
51
53
  ripple: { type: Boolean, default: false },
52
54
  /** 按下的类名 */
53
55
  hoverClass: { type: String, default: '' },
54
- /** 自定义样式,对象形式 */
55
- customStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
56
56
  /** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
57
57
  dataName: { type: String, default: '' },
58
58
  /** 节流,一定时间内只能触发一次 */
@@ -9,7 +9,8 @@
9
9
  shape === 'circle' ? 'u-round-circle' : '',
10
10
  hairLine ? showHairLineBorder : 'u-btn--bold-border',
11
11
  'u-btn--' + type,
12
- disabled ? `u-btn--${type}--disabled` : ''
12
+ disabled ? `u-btn--${type}--disabled` : '',
13
+ customClass
13
14
  ]"
14
15
  :hover-start-time="Number(hoverStartTime)"
15
16
  :hover-stay-time="Number(hoverStayTime)"
@@ -34,12 +35,14 @@
34
35
  @opensetting="opensetting"
35
36
  @chooseavatar="chooseavatar"
36
37
  @agreeprivacyauthorization="agreeprivacyauthorization"
37
- :style="[
38
- customStyle,
39
- {
40
- overflow: ripple ? 'hidden' : 'visible'
41
- }
42
- ]"
38
+ :style="
39
+ $u.toStyle(
40
+ {
41
+ overflow: ripple ? 'hidden' : 'visible'
42
+ },
43
+ customStyle
44
+ )
45
+ "
43
46
  @tap.stop="click($event)"
44
47
  :hover-class="getHoverClass"
45
48
  :loading="loading"
@@ -60,14 +63,24 @@
60
63
  </button>
61
64
  </template>
62
65
 
66
+ <script lang="ts">
67
+ export default {
68
+ name: 'u-button',
69
+ options: {
70
+ addGlobalClass: true,
71
+ // #ifndef MP-TOUTIAO
72
+ virtualHost: true,
73
+ // #endif
74
+ styleIsolation: 'shared'
75
+ }
76
+ };
77
+ </script>
78
+
63
79
  <script setup lang="ts">
64
80
  import { ref, computed, nextTick } from 'vue';
65
81
  import { $u } from '../../';
66
82
  import { ButtonProps } from './types';
67
83
 
68
- defineOptions({
69
- name: 'u-button'
70
- });
71
84
  /**
72
85
  * button 按钮
73
86
  * @description Button 按钮
@@ -1,10 +1,12 @@
1
1
  import { type ExtractPropTypes } from 'vue';
2
+ import { baseProps } from '../common/props';
2
3
 
3
4
  /**
4
5
  * u-car-keyboard 车牌号键盘类型定义
5
6
  * @description 供 u-car-keyboard 组件 props 使用
6
7
  */
7
8
  export const CarKeyboardProps = {
9
+ ...baseProps,
8
10
  /** 是否打乱键盘按键的顺序 */
9
11
  random: { type: Boolean, default: false }
10
12
  };
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="u-keyboard" @touchmove.stop.prevent="() => {}">
2
+ <view class="u-keyboard" :class="customClass" :style="$u.toStyle(customStyle)" @touchmove.stop.prevent="() => {}">
3
3
  <view class="u-keyboard-grids">
4
4
  <view>
5
5
  <view class="u-keyboard-grids-item" v-for="(group, i) in abc ? EngKeyBoardList : areaList" :key="i">
@@ -38,15 +38,24 @@
38
38
  </view>
39
39
  </template>
40
40
 
41
+ <script lang="ts">
42
+ export default {
43
+ name: 'u-car-keyboard',
44
+ options: {
45
+ addGlobalClass: true,
46
+ // #ifndef MP-TOUTIAO
47
+ virtualHost: true,
48
+ // #endif
49
+ styleIsolation: 'shared'
50
+ }
51
+ };
52
+ </script>
53
+
41
54
  <script setup lang="ts">
42
55
  import { ref, computed } from 'vue';
43
56
  import { $u } from '../..';
44
57
  import { CarKeyboardProps } from './types';
45
58
 
46
- defineOptions({
47
- name: 'u-car-keyboard'
48
- });
49
-
50
59
  /**
51
60
  * u-car-keyboard 车牌号键盘
52
61
  * @description 车牌号输入专用键盘,支持省份简称和字母数字切换,支持按键顺序打乱。
@@ -1,4 +1,5 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
+ import { baseProps } from '../common/props';
2
3
 
3
4
  /**
4
5
  * card 卡片类型定义
@@ -8,6 +9,7 @@ export type CardIndex = string | number | Record<string, any>;
8
9
  export type CardStyle = Record<string, any>;
9
10
 
10
11
  export const CardProps = {
12
+ ...baseProps,
11
13
  /** 与屏幕两侧是否留空隙 */
12
14
  full: { type: Boolean, default: false },
13
15
  /** 标题 */
@@ -2,12 +2,17 @@
2
2
  <view
3
3
  class="u-card"
4
4
  @tap.stop="onClick"
5
- :class="{ 'u-border': border, 'u-card-full': full, 'u-card--border': Number(borderRadius) > 0 }"
6
- :style="{
7
- borderRadius: borderRadius + 'rpx',
8
- margin: margin,
9
- boxShadow: boxShadow
10
- }"
5
+ :class="[{ 'u-border': border, 'u-card-full': full, 'u-card--border': Number(borderRadius) > 0 }, customClass]"
6
+ :style="
7
+ $u.toStyle(
8
+ {
9
+ borderRadius: borderRadius + 'rpx',
10
+ margin: margin,
11
+ boxShadow: boxShadow
12
+ },
13
+ customStyle
14
+ )
15
+ "
11
16
  >
12
17
  <view
13
18
  v-if="showHead"
@@ -72,13 +77,23 @@
72
77
  </view>
73
78
  </template>
74
79
 
80
+ <script lang="ts">
81
+ export default {
82
+ name: 'u-card',
83
+ options: {
84
+ addGlobalClass: true,
85
+ // #ifndef MP-TOUTIAO
86
+ virtualHost: true,
87
+ // #endif
88
+ styleIsolation: 'shared'
89
+ }
90
+ };
91
+ </script>
92
+
75
93
  <script setup lang="ts">
76
94
  import { useSlots } from 'vue';
77
95
  import { CardProps } from './types';
78
-
79
- defineOptions({
80
- name: 'u-card'
81
- });
96
+ import { $u } from '../..';
82
97
 
83
98
  /**
84
99
  * card 卡片
@@ -1,4 +1,5 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
+ import { baseProps } from '../common/props';
2
3
 
3
4
  /**
4
5
  * cell-group 组件 props 类型定义
@@ -6,6 +7,7 @@ import { type ExtractPropTypes, type PropType } from 'vue';
6
7
  */
7
8
 
8
9
  export const CellGroupProps = {
10
+ ...baseProps,
9
11
  /** 分组标题 */
10
12
  title: { type: String, default: '' },
11
13
  /** 是否显示分组list上下边框 */
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="u-cell-box">
2
+ <view class="u-cell-box" :class="customClass" :style="$u.toStyle(customStyle)">
3
3
  <view class="u-cell-title" v-if="title" :style="[titleStyle]">
4
4
  {{ title }}
5
5
  </view>
@@ -9,12 +9,22 @@
9
9
  </view>
10
10
  </template>
11
11
 
12
+ <script lang="ts">
13
+ export default {
14
+ name: 'u-cell-group',
15
+ options: {
16
+ addGlobalClass: true,
17
+ // #ifndef MP-TOUTIAO
18
+ virtualHost: true,
19
+ // #endif
20
+ styleIsolation: 'shared'
21
+ }
22
+ };
23
+ </script>
24
+
12
25
  <script setup lang="ts">
13
26
  import { CellGroupProps } from './types';
14
-
15
- defineOptions({
16
- name: 'u-cell-group'
17
- });
27
+ import { $u } from '../..';
18
28
 
19
29
  /**
20
30
  * cellGroup 单元格父组件Group
@@ -1,5 +1,6 @@
1
1
  import { type ExtractPropTypes, type PropType } from 'vue';
2
2
  import type { CellItemArrowDirection } from '../../types/global';
3
+ import { baseProps } from '../common/props';
3
4
 
4
5
  /**
5
6
  * cell-item 组件 props 类型定义
@@ -9,6 +10,7 @@ export type CellItemIndex = string | number;
9
10
  export type CellItemStyle = Record<string, any>;
10
11
 
11
12
  export const CellItemProps = {
13
+ ...baseProps,
12
14
  /** 左侧图标名称(只能uView内置图标),或者图标src */
13
15
  icon: { type: String, default: '' },
14
16
  /** 左侧标题 */