uview-pro 0.0.7 → 0.0.8

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 (174) hide show
  1. package/changelog.md +5 -0
  2. package/components/u-action-sheet/types.ts +35 -0
  3. package/components/u-action-sheet/u-action-sheet.vue +2 -47
  4. package/components/u-alert-tips/types.ts +39 -0
  5. package/components/u-alert-tips/u-alert-tips.vue +3 -32
  6. package/components/u-avatar/types.ts +34 -0
  7. package/components/u-avatar/u-avatar.vue +3 -30
  8. package/components/u-avatar-cropper/types.ts +23 -0
  9. package/components/u-avatar-cropper/u-avatar-cropper.vue +2 -45
  10. package/components/u-back-top/types.ts +39 -0
  11. package/components/u-back-top/u-back-top.vue +2 -33
  12. package/components/u-badge/types.ts +36 -0
  13. package/components/u-badge/u-badge.vue +2 -26
  14. package/components/u-button/types.ts +66 -0
  15. package/components/u-button/u-button.vue +3 -88
  16. package/components/u-calendar/types.ts +63 -0
  17. package/components/u-calendar/u-calendar.vue +2 -135
  18. package/components/u-car-keyboard/types.ts +12 -0
  19. package/components/u-car-keyboard/u-car-keyboard.vue +2 -4
  20. package/components/u-card/types.ts +59 -0
  21. package/components/u-card/u-card.vue +2 -48
  22. package/components/u-cell-group/types.ts +17 -0
  23. package/components/u-cell-group/u-cell-group.vue +3 -9
  24. package/components/u-cell-item/types.ts +54 -0
  25. package/components/u-cell-item/u-cell-item.vue +2 -45
  26. package/components/u-checkbox/types.ts +31 -0
  27. package/components/u-checkbox/u-checkbox.vue +2 -47
  28. package/components/u-checkbox-group/types.ts +32 -0
  29. package/components/u-checkbox-group/u-checkbox-group.vue +2 -57
  30. package/components/u-circle-progress/types.ts +52 -0
  31. package/components/u-circle-progress/u-circle-progress.vue +2 -23
  32. package/components/u-city-select/types.ts +20 -0
  33. package/components/u-city-select/u-city-select.vue +2 -10
  34. package/components/u-col/types.ts +30 -0
  35. package/components/u-col/u-col.vue +2 -14
  36. package/components/u-collapse/types.ts +31 -0
  37. package/components/u-collapse/u-collapse.vue +2 -16
  38. package/components/u-collapse-item/types.ts +25 -0
  39. package/components/u-collapse-item/u-collapse-item.vue +2 -16
  40. package/components/u-column-notice/types.ts +48 -0
  41. package/components/u-column-notice/u-column-notice.vue +2 -97
  42. package/components/u-count-down/types.ts +42 -0
  43. package/components/u-count-down/u-count-down.vue +2 -82
  44. package/components/u-count-to/types.ts +32 -0
  45. package/components/u-count-to/u-count-to.vue +2 -58
  46. package/components/u-divider/types.ts +31 -0
  47. package/components/u-divider/u-divider.vue +2 -22
  48. package/components/u-dropdown/types.ts +32 -0
  49. package/components/u-dropdown/u-dropdown.vue +2 -24
  50. package/components/u-dropdown-item/types.ts +27 -0
  51. package/components/u-dropdown-item/u-dropdown-item.vue +4 -16
  52. package/components/u-empty/types.ts +36 -0
  53. package/components/u-empty/u-empty.vue +3 -26
  54. package/components/u-field/types.ts +69 -0
  55. package/components/u-field/u-field.vue +2 -117
  56. package/components/u-form/types.ts +25 -0
  57. package/components/u-form/u-form.vue +2 -46
  58. package/components/u-form-item/types.ts +70 -0
  59. package/components/u-form-item/u-form-item.vue +2 -62
  60. package/components/u-full-screen/types.ts +14 -0
  61. package/components/u-full-screen/u-full-screen.vue +2 -0
  62. package/components/u-gap/types.ts +18 -0
  63. package/components/u-gap/u-gap.vue +2 -10
  64. package/components/u-grid/types.ts +19 -0
  65. package/components/u-grid/u-grid.vue +3 -11
  66. package/components/u-grid-item/types.ts +16 -0
  67. package/components/u-grid-item/u-grid-item.vue +2 -8
  68. package/components/u-icon/types.ts +62 -0
  69. package/components/u-icon/u-icon.vue +2 -123
  70. package/components/u-image/types.ts +39 -38
  71. package/components/u-index-anchor/types.ts +16 -0
  72. package/components/u-index-anchor/u-index-anchor.vue +2 -17
  73. package/components/u-index-list/types.ts +43 -0
  74. package/components/u-index-list/u-index-list.vue +13 -34
  75. package/components/u-input/types.ts +140 -0
  76. package/components/u-input/u-input.vue +2 -209
  77. package/components/u-keyboard/types.ts +40 -0
  78. package/components/u-keyboard/u-keyboard.vue +2 -32
  79. package/components/u-lazy-load/types.ts +37 -0
  80. package/components/u-lazy-load/u-lazy-load.vue +3 -58
  81. package/components/u-line/types.ts +44 -0
  82. package/components/u-line/u-line.vue +2 -14
  83. package/components/u-line-progress/types.ts +58 -0
  84. package/components/u-line-progress/u-line-progress.vue +2 -21
  85. package/components/u-link/types.ts +43 -0
  86. package/components/u-link/u-link.vue +2 -14
  87. package/components/u-loading/types.ts +35 -0
  88. package/components/u-loading/u-loading.vue +2 -23
  89. package/components/u-loadmore/types.ts +79 -0
  90. package/components/u-loadmore/u-loadmore.vue +2 -67
  91. package/components/u-mask/types.ts +43 -0
  92. package/components/u-mask/u-mask.vue +2 -33
  93. package/components/u-message-input/types.ts +74 -0
  94. package/components/u-message-input/u-message-input.vue +2 -62
  95. package/components/u-modal/types.ts +118 -0
  96. package/components/u-modal/u-modal.vue +2 -86
  97. package/components/u-navbar/types.ts +103 -0
  98. package/components/u-navbar/u-navbar.vue +2 -90
  99. package/components/u-no-network/types.ts +28 -0
  100. package/components/u-no-network/u-no-network.vue +2 -23
  101. package/components/u-notice-bar/types.ts +111 -0
  102. package/components/u-notice-bar/u-notice-bar.vue +2 -102
  103. package/components/u-number-box/types.ts +42 -0
  104. package/components/u-number-box/u-number-box.vue +2 -34
  105. package/components/u-number-keyboard/types.ts +26 -0
  106. package/components/u-number-keyboard/u-number-keyboard.vue +2 -8
  107. package/components/u-picker/types.ts +111 -0
  108. package/components/u-picker/u-picker.vue +3 -174
  109. package/components/u-popup/types.ts +59 -0
  110. package/components/u-popup/u-popup.vue +2 -47
  111. package/components/u-radio/types.ts +25 -0
  112. package/components/u-radio/u-radio.vue +2 -16
  113. package/components/u-radio-group/types.ts +29 -0
  114. package/components/u-radio-group/u-radio-group.vue +2 -20
  115. package/components/u-rate/types.ts +40 -0
  116. package/components/u-rate/u-rate.vue +2 -124
  117. package/components/u-read-more/types.ts +35 -0
  118. package/components/u-read-more/u-read-more.vue +2 -51
  119. package/components/u-row/types.ts +20 -0
  120. package/components/u-row/u-row.vue +2 -10
  121. package/components/u-row-notice/types.ts +39 -0
  122. package/components/u-row-notice/u-row-notice.vue +2 -72
  123. package/components/u-search/types.ts +53 -0
  124. package/components/u-search/u-search.vue +2 -44
  125. package/components/u-section/types.ts +32 -0
  126. package/components/u-section/u-section.vue +2 -52
  127. package/components/u-select/types.ts +43 -0
  128. package/components/u-select/u-select.vue +2 -34
  129. package/components/u-skeleton/types.ts +20 -0
  130. package/components/u-skeleton/u-skeleton.vue +2 -27
  131. package/components/u-slider/types.ts +32 -0
  132. package/components/u-slider/u-slider.vue +2 -57
  133. package/components/u-steps/types.ts +28 -0
  134. package/components/u-steps/u-steps.vue +2 -42
  135. package/components/u-sticky/types.ts +22 -0
  136. package/components/u-sticky/u-sticky.vue +2 -32
  137. package/components/u-subsection/types.ts +36 -0
  138. package/components/u-subsection/u-subsection.vue +2 -62
  139. package/components/u-swipe-action/types.ts +50 -0
  140. package/components/u-swipe-action/u-swipe-action.vue +2 -39
  141. package/components/u-swiper/types.ts +47 -0
  142. package/components/u-swiper/u-swiper.vue +2 -41
  143. package/components/u-switch/types.ts +28 -0
  144. package/components/u-switch/u-switch.vue +2 -20
  145. package/components/u-tabbar/types.ts +36 -0
  146. package/components/u-tabbar/u-tabbar.vue +6 -75
  147. package/components/u-table/types.ts +25 -0
  148. package/components/u-table/u-table.vue +2 -51
  149. package/components/u-tabs/types.ts +51 -0
  150. package/components/u-tabs/u-tabs.vue +6 -44
  151. package/components/u-tabs-swiper/types.ts +53 -0
  152. package/components/u-tabs-swiper/u-tabs-swiper.vue +3 -50
  153. package/components/u-tag/types.ts +37 -0
  154. package/components/u-tag/u-tag.vue +2 -28
  155. package/components/u-td/types.ts +12 -0
  156. package/components/u-td/u-td.vue +2 -9
  157. package/components/u-th/types.ts +12 -0
  158. package/components/u-th/u-th.vue +2 -9
  159. package/components/u-time-line-item/types.ts +14 -0
  160. package/components/u-time-line-item/u-time-line-item.vue +2 -12
  161. package/components/u-toast/types.ts +35 -3
  162. package/components/u-toast/u-toast.vue +2 -7
  163. package/components/u-top-tips/types.ts +14 -0
  164. package/components/u-top-tips/u-top-tips.vue +17 -22
  165. package/components/u-tr/types.ts +8 -0
  166. package/components/u-tr/u-tr.vue +3 -0
  167. package/components/u-upload/types.ts +71 -0
  168. package/components/u-upload/u-upload.vue +6 -67
  169. package/components/u-verification-code/types.ts +22 -0
  170. package/components/u-verification-code/u-verification-code.vue +2 -32
  171. package/components/u-waterfall/types.ts +16 -0
  172. package/components/u-waterfall/u-waterfall.vue +2 -18
  173. package/package.json +1 -1
  174. package/types/global.d.ts +200 -0
@@ -79,6 +79,7 @@
79
79
  </template>
80
80
 
81
81
  <script setup lang="ts">
82
+ import { FieldProps } from './types';
82
83
  import { ref, computed } from 'vue';
83
84
  import { $u } from '../..';
84
85
 
@@ -156,123 +157,7 @@ const emit = defineEmits(['update:modelValue', 'focus', 'blur', 'confirm', 'righ
156
157
  * @property {string|number} value 输入框绑定值
157
158
  * @property {string} type 输入框类型(text/textarea/password等,默认text)
158
159
  */
159
- const props = defineProps({
160
- /** label左边的图标,限uView的图标名称 */
161
- icon: String,
162
- /** 输入框右边的图标名称,限uView的图标名称(默认false) */
163
- rightIcon: String,
164
- /** 方向属性 */
165
- arrowDirection: {
166
- type: String,
167
- default: 'right'
168
- },
169
- /** 是否必填,左边显示红色"*"号(默认false) */
170
- required: Boolean,
171
- /** 输入框左边的文字提示 */
172
- label: String,
173
- /** 是否密码输入方式(用点替换文字),type为text时有效(默认false) */
174
- password: Boolean,
175
- /** 是否显示右侧清空内容的图标控件(默认true) */
176
- clearable: {
177
- type: Boolean,
178
- default: true
179
- },
180
- /** label的宽度,单位rpx(默认130) */
181
- labelWidth: {
182
- type: [Number, String],
183
- default: 130
184
- },
185
- /** label的文字对齐方式(默认left) */
186
- labelAlign: {
187
- type: String,
188
- default: 'left'
189
- },
190
- /** 输入框内容对齐方式(默认left) */
191
- inputAlign: {
192
- type: String,
193
- default: 'left'
194
- },
195
- /** 左边通过icon配置的图标的颜色(默认#606266) */
196
- iconColor: {
197
- type: String,
198
- default: '#606266'
199
- },
200
- /** 是否自动增高输入区域,type为textarea时有效(默认true) */
201
- autoHeight: {
202
- type: Boolean,
203
- default: true
204
- },
205
- /** 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息 */
206
- errorMessage: {
207
- type: [String, Boolean],
208
- default: ''
209
- },
210
- /** 输入框的提示文字 */
211
- placeholder: String,
212
- /** placeholder的样式(内联样式,字符串),如"color: #ddd" */
213
- placeholderStyle: String,
214
- /** 是否自动获得焦点(默认false) */
215
- focus: Boolean,
216
- /** 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false) */
217
- fixed: Boolean,
218
- /** 输入框绑定值 */
219
- modelValue: [Number, String],
220
- /** 输入框类型(text/textarea/password等,默认text) */
221
- type: {
222
- type: String,
223
- default: 'text'
224
- },
225
- /** 是否不可输入(默认false) */
226
- disabled: {
227
- type: Boolean,
228
- default: false
229
- },
230
- /** 最大输入长度,设置为 -1 的时候不限制最大长度(默认140) */
231
- maxlength: {
232
- type: [Number, String],
233
- default: 140
234
- },
235
- /** 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done) */
236
- confirmType: {
237
- type: String,
238
- default: 'done'
239
- },
240
- /** label位置(默认left)left-左边,top-上边 */
241
- labelPosition: {
242
- type: String,
243
- default: 'left'
244
- },
245
- /** 自定义输入框的样式,对象形式 */
246
- fieldStyle: {
247
- type: Object as () => Record<string, any>,
248
- default: () => ({})
249
- },
250
- /** 清除图标的大小,单位rpx(默认30) */
251
- clearSize: {
252
- type: [Number, String],
253
- default: 30
254
- },
255
- /** 左侧图标样式 */
256
- iconStyle: {
257
- type: Object as () => Record<string, any>,
258
- default: () => ({})
259
- },
260
- /** 是否显示field的上边框(默认false) */
261
- borderTop: {
262
- type: Boolean,
263
- default: false
264
- },
265
- /** 是否显示field的下边框(默认true) */
266
- borderBottom: {
267
- type: Boolean,
268
- default: true
269
- },
270
- /** 是否自动去除输入内容首尾空格(默认true) */
271
- trim: {
272
- type: Boolean,
273
- default: true
274
- }
275
- });
160
+ const props = defineProps(FieldProps);
276
161
 
277
162
  const focused = ref(false);
278
163
  const itemIndex = ref(0);
@@ -0,0 +1,25 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { InputAlign, InputErrorType, InputLabelPosition } from '../../types/global';
3
+
4
+ /**
5
+ * u-form 组件 Props 类型定义
6
+ * @description 表单组件属性
7
+ */
8
+ export const FormProps = {
9
+ /** 当前form的需要验证字段的集合 */
10
+ model: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
11
+ /** 有错误时的提示方式,message-提示信息,border-如果input设置了边框,变成呈红色,border-bottom-下边框呈现红色,none-无提示 */
12
+ errorType: { type: Array as PropType<InputErrorType[]>, default: () => ['message', 'toast'] },
13
+ /** 是否显示表单域的下划线边框 */
14
+ borderBottom: { type: Boolean, default: true },
15
+ /** label的位置,left-左边,top-上边 */
16
+ labelPosition: { type: String as PropType<InputLabelPosition>, default: 'left' },
17
+ /** label的宽度,单位rpx */
18
+ labelWidth: { type: [String, Number] as PropType<string | number>, default: 90 },
19
+ /** lable字体的对齐方式 */
20
+ labelAlign: { type: String as PropType<InputAlign>, default: 'left' },
21
+ /** lable的样式,对象形式 */
22
+ labelStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) }
23
+ };
24
+
25
+ export type FormProps = ExtractPropTypes<typeof FormProps>;
@@ -3,6 +3,7 @@
3
3
  </template>
4
4
 
5
5
  <script setup lang="ts">
6
+ import { FormProps } from './types';
6
7
  import { ref, provide } from 'vue';
7
8
  import { $u } from '../..';
8
9
 
@@ -25,52 +26,7 @@ defineOptions({
25
26
  * @example <u-form :model="form" ref="uForm"></u-form>
26
27
  */
27
28
 
28
- const props = defineProps({
29
- /** 当前form的需要验证字段的集合 */
30
- model: {
31
- type: Object,
32
- default: () => ({})
33
- },
34
- // 验证规则
35
- // rules: {
36
- // type: [Object, Function, Array],
37
- // default() {
38
- // return {};
39
- // }
40
- // },
41
- /**
42
- * 有错误时的提示方式,message-提示信息,border-如果input设置了边框,变成呈红色,border-bottom-下边框呈现红色,none-无提示
43
- */
44
- errorType: {
45
- type: Array,
46
- default: () => ['message', 'toast']
47
- },
48
- /** 是否显示表单域的下划线边框 */
49
- borderBottom: {
50
- type: Boolean,
51
- default: true
52
- },
53
- /** label的位置,left-左边,top-上边 */
54
- labelPosition: {
55
- type: String,
56
- default: 'left'
57
- },
58
- /** label的宽度,单位rpx */
59
- labelWidth: {
60
- type: [String, Number],
61
- default: 90
62
- },
63
- /** lable字体的对齐方式 */
64
- labelAlign: {
65
- type: String,
66
- default: 'left'
67
- },
68
- /** lable的样式,对象形式 */
69
- labelStyle: {
70
- type: Object,
71
- default: () => ({})
72
- }
73
- });
29
+ const props = defineProps(FormProps);
74
30
 
75
31
  // 存储当前form下的所有u-form-item的实例
76
32
  const fields = ref<any[]>([]);
@@ -0,0 +1,70 @@
1
+ import type { PropType, ExtractPropTypes } from 'vue';
2
+ import type { InputAlign, InputLabelPosition } from '../../types/global';
3
+
4
+ /**
5
+ * form-item 表单item Props
6
+ */
7
+ export const FormItemProps = {
8
+ /** input的label提示语 */
9
+ label: {
10
+ type: String,
11
+ default: ''
12
+ },
13
+ /** 绑定的值 */
14
+ prop: {
15
+ type: String,
16
+ default: ''
17
+ },
18
+ /** 是否显示表单域的下划线边框 */
19
+ borderBottom: {
20
+ type: [String, Boolean] as PropType<string | boolean>,
21
+ default: ''
22
+ },
23
+ /** label的位置,left-左边,top-上边 */
24
+ labelPosition: {
25
+ type: String as PropType<InputLabelPosition>,
26
+ default: ''
27
+ },
28
+ /** label的宽度,单位rpx */
29
+ labelWidth: {
30
+ type: [String, Number] as PropType<string | number>,
31
+ default: ''
32
+ },
33
+ /** lable的样式,对象形式 */
34
+ labelStyle: {
35
+ type: Object as PropType<Record<string, any>>,
36
+ default: () => ({})
37
+ },
38
+ /** lable字体的对齐方式 */
39
+ labelAlign: {
40
+ type: String as PropType<InputAlign>,
41
+ default: ''
42
+ },
43
+ /** 右侧图标 */
44
+ rightIcon: {
45
+ type: String,
46
+ default: ''
47
+ },
48
+ /** 左侧图标 */
49
+ leftIcon: {
50
+ type: String,
51
+ default: ''
52
+ },
53
+ /** 左侧图标的样式 */
54
+ leftIconStyle: {
55
+ type: Object as PropType<Record<string, any>>,
56
+ default: () => ({})
57
+ },
58
+ /** 右侧图标的样式 */
59
+ rightIconStyle: {
60
+ type: Object as PropType<Record<string, any>>,
61
+ default: () => ({})
62
+ },
63
+ /** 是否显示左边的必填星号,只作显示用,具体校验必填的逻辑,请在rules中配置 */
64
+ required: {
65
+ type: Boolean,
66
+ default: false
67
+ }
68
+ };
69
+
70
+ export type FormItemProps = ExtractPropTypes<typeof FormItemProps>;
@@ -70,6 +70,7 @@ import { $u } from '../..';
70
70
  import { broadcast } from '../../libs/util/emitter';
71
71
  // @ts-ignore
72
72
  import schema from '../../libs/util/async-validator';
73
+ import { FormItemProps } from './types';
73
74
  // 去除警告信息
74
75
  schema.warning = function () {};
75
76
 
@@ -96,68 +97,7 @@ defineOptions({
96
97
  * @example <u-form-item label="姓名"><u-input v-model="form.name" /></u-form-item>
97
98
  */
98
99
 
99
- const props = defineProps({
100
- /** input的label提示语 */
101
- label: {
102
- type: String,
103
- default: ''
104
- },
105
- /** 绑定的值 */
106
- prop: {
107
- type: String,
108
- default: ''
109
- },
110
- /** 是否显示表单域的下划线边框 */
111
- borderBottom: {
112
- type: [String, Boolean],
113
- default: ''
114
- },
115
- /** label的位置,left-左边,top-上边 */
116
- labelPosition: {
117
- type: String,
118
- default: ''
119
- },
120
- /** label的宽度,单位rpx */
121
- labelWidth: {
122
- type: [String, Number],
123
- default: ''
124
- },
125
- /** lable的样式,对象形式 */
126
- labelStyle: {
127
- type: Object,
128
- default: () => ({})
129
- },
130
- /** lable字体的对齐方式 */
131
- labelAlign: {
132
- type: String,
133
- default: ''
134
- },
135
- /** 右侧图标 */
136
- rightIcon: {
137
- type: String,
138
- default: ''
139
- },
140
- /** 左侧图标 */
141
- leftIcon: {
142
- type: String,
143
- default: ''
144
- },
145
- /** 左侧图标的样式 */
146
- leftIconStyle: {
147
- type: Object,
148
- default: () => ({})
149
- },
150
- /** 右侧图标的样式 */
151
- rightIconStyle: {
152
- type: Object,
153
- default: () => ({})
154
- },
155
- /** 是否显示左边的必填星号,只作显示用,具体校验必填的逻辑,请在rules中配置 */
156
- required: {
157
- type: Boolean,
158
- default: false
159
- }
160
- });
100
+ const props = defineProps(FormItemProps);
161
101
 
162
102
  // inject 父表单实例
163
103
  const parent = inject<any>('u-form', null);
@@ -0,0 +1,14 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-full-screen 组件 Props 类型定义
5
+ * @description 用于APP弹窗遮盖导航栏和底部tabbar,提示新版本升级内容
6
+ */
7
+ export const FullScreenProps = {
8
+ /** 是否显示弹窗 */
9
+ show: { type: Boolean, default: false },
10
+ /** 升级内容,支持富文本 */
11
+ content: { type: String, default: '' }
12
+ };
13
+
14
+ export type FullScreenProps = ExtractPropTypes<typeof FullScreenProps>;
@@ -7,6 +7,7 @@
7
7
  </template>
8
8
 
9
9
  <script setup lang="ts">
10
+ import { FullScreenProps } from './types';
10
11
  import { ref, onMounted } from 'vue';
11
12
 
12
13
  defineOptions({ name: 'u-full-screen' });
@@ -17,6 +18,7 @@ defineOptions({ name: 'u-full-screen' });
17
18
  * @property {boolean} show 是否显示弹窗
18
19
  * @property {string} content 升级内容,支持富文本
19
20
  */
21
+ defineProps(FullScreenProps);
20
22
 
21
23
  /**
22
24
  * 是否显示弹窗
@@ -0,0 +1,18 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-gap 组件 Props 类型定义
5
+ * @description 间隔槽组件属性
6
+ */
7
+ export const GapProps = {
8
+ /** 背景颜色 */
9
+ bgColor: { type: String, default: 'transparent' },
10
+ /** 高度 */
11
+ height: { type: [String, Number] as PropType<string | number>, default: 30 },
12
+ /** 与上一个组件的距离 */
13
+ marginTop: { type: [String, Number] as PropType<string | number>, default: 0 },
14
+ /** 与下一个组件的距离 */
15
+ marginBottom: { type: [String, Number] as PropType<string | number>, default: 0 }
16
+ };
17
+
18
+ export type GapProps = ExtractPropTypes<typeof GapProps>;
@@ -3,6 +3,7 @@
3
3
  </template>
4
4
 
5
5
  <script setup lang="ts">
6
+ import { GapProps } from './types';
6
7
  import { computed } from 'vue';
7
8
 
8
9
  defineOptions({
@@ -19,16 +20,7 @@ defineOptions({
19
20
  * @property {String Number} margin-bottom 与后一个组件的距离,单位rpx(0)
20
21
  * @example <u-gap height="80" bg-color="#bbb"></u-gap>
21
22
  */
22
- const props = defineProps({
23
- /** 背景颜色 */
24
- bgColor: { type: String, default: 'transparent' },
25
- /** 高度 */
26
- height: { type: [String, Number], default: 30 },
27
- /** 与上一个组件的距离 */
28
- marginTop: { type: [String, Number], default: 0 },
29
- /** 与下一个组件的距离 */
30
- marginBottom: { type: [String, Number], default: 0 }
31
- });
23
+ const props = defineProps(GapProps);
32
24
 
33
25
  /**
34
26
  * 间隔槽样式
@@ -0,0 +1,19 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { InputAlign } from '../../types/global';
3
+
4
+ /**
5
+ * u-grid 组件 Props 类型定义
6
+ * @description 宫格组件属性
7
+ */
8
+ export const GridProps = {
9
+ /** 分成几列 */
10
+ col: { type: [Number, String] as PropType<string | number>, default: 3 },
11
+ /** 是否显示边框 */
12
+ border: { type: Boolean, default: true },
13
+ /** 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右 */
14
+ align: { type: String as PropType<InputAlign>, default: 'left' },
15
+ /** 宫格按压时的样式类,"none"为无效果 */
16
+ hoverClass: { type: String, default: 'u-hover-class' }
17
+ };
18
+
19
+ export type GridProps = ExtractPropTypes<typeof GridProps>;
@@ -5,7 +5,9 @@
5
5
  </template>
6
6
 
7
7
  <script setup lang="ts">
8
+ import { GridProps } from './types';
8
9
  import { ref, computed, watch } from 'vue';
10
+
9
11
  defineOptions({ name: 'u-grid' });
10
12
 
11
13
  /**
@@ -18,17 +20,7 @@ defineOptions({ name: 'u-grid' });
18
20
  * @event {Function} click 点击宫格触发
19
21
  * @example <u-grid :col="3" @click="click"></u-grid>
20
22
  */
21
-
22
- const props = defineProps({
23
- /** 分成几列 */
24
- col: { type: [Number, String], default: 3 },
25
- /** 是否显示边框 */
26
- border: { type: Boolean, default: true },
27
- /** 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右 */
28
- align: { type: String, default: 'left' },
29
- /** 宫格按压时的样式类,"none"为无效果 */
30
- hoverClass: { type: String, default: 'u-hover-class' }
31
- });
23
+ const props = defineProps(GridProps);
32
24
 
33
25
  // emits 定义
34
26
  const emit = defineEmits(['click']);
@@ -0,0 +1,16 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-grid-item 组件 Props 类型定义
5
+ * @description 宫格项组件属性
6
+ */
7
+ export const GridItemProps = {
8
+ /** 背景颜色 */
9
+ bgColor: { type: String, default: '#ffffff' },
10
+ /** 点击时返回的index */
11
+ index: { type: [Number, String] as PropType<string | number>, default: '' },
12
+ /** 自定义样式,对象形式 */
13
+ customStyle: { type: Object as PropType<Record<string, any>>, default: () => ({ padding: '30rpx 0' }) }
14
+ };
15
+
16
+ export type GridItemProps = ExtractPropTypes<typeof GridItemProps>;
@@ -16,6 +16,7 @@
16
16
  </template>
17
17
 
18
18
  <script setup lang="ts">
19
+ import { GridItemProps } from './types';
19
20
  import { ref, computed, getCurrentInstance, onMounted } from 'vue';
20
21
  import { $u } from '../..';
21
22
 
@@ -33,14 +34,7 @@ defineOptions({ name: 'u-grid-item' });
33
34
  */
34
35
 
35
36
  // props 定义,保留参数注释
36
- const props = defineProps({
37
- /** 背景颜色 */
38
- bgColor: { type: String, default: '#ffffff' },
39
- /** 点击时返回的index */
40
- index: { type: [Number, String], default: '' },
41
- /** 自定义样式,对象形式 */
42
- customStyle: { type: Object, default: () => ({ padding: '30rpx 0' }) }
43
- });
37
+ const props = defineProps(GridItemProps);
44
38
 
45
39
  // emits 定义
46
40
  const emit = defineEmits(['click']);
@@ -0,0 +1,62 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { IconLabelPosition, ImgMode } from '../../types/global';
3
+
4
+ /**
5
+ * u-icon 组件 Props 类型定义
6
+ * 所有属性均带详细注释,类型安全,便于 IDE 智能提示
7
+ */
8
+ export const IconProps = {
9
+ /** 图标名称,见示例图标集 */
10
+ name: { type: String, default: '' },
11
+ /** 图标颜色,可接受主题色 */
12
+ color: { type: String, default: '' },
13
+ /** 字体大小,单位rpx(默认32) */
14
+ size: { type: [Number, String] as PropType<string | number>, default: 'inherit' },
15
+ /** 是否显示粗体 */
16
+ bold: { type: Boolean, default: false },
17
+ /** 点击图标的时候传递事件出去的index(用于区分点击了哪一个) */
18
+ index: { type: [Number, String] as PropType<string | number>, default: '' },
19
+ /** 触摸图标时的类名 */
20
+ hoverClass: { type: String, default: '' },
21
+ /** 自定义扩展前缀,方便用户扩展自己的图标库 */
22
+ customPrefix: { type: String, default: 'uicon' },
23
+ /** 图标右边或者下面的文字 */
24
+ label: { type: [String, Number] as PropType<string | number>, default: '' },
25
+ /** label的位置,只能右边或者下边 */
26
+ labelPos: { type: String as PropType<IconLabelPosition>, default: 'right' },
27
+ /** label的大小,单位rpx(默认28) */
28
+ labelSize: { type: [String, Number] as PropType<string | number>, default: '28' },
29
+ /** label的颜色 */
30
+ labelColor: { type: String, default: '#606266' },
31
+ /** label与图标的距离(横向排列),单位rpx(默认6) */
32
+ marginLeft: { type: [String, Number] as PropType<string | number>, default: '6' },
33
+ /** label与图标的距离(竖向排列),单位rpx(默认6) */
34
+ marginTop: { type: [String, Number] as PropType<string | number>, default: '6' },
35
+ /** label与图标的距离(竖向排列),单位rpx(默认6) */
36
+ marginRight: { type: [String, Number] as PropType<string | number>, default: '6' },
37
+ /** label与图标的距离(竖向排列),单位rpx(默认6) */
38
+ marginBottom: { type: [String, Number] as PropType<string | number>, default: '6' },
39
+ /** label与图标的距离,单位rpx,权重高于 margin */
40
+ space: { type: [String, Number] as PropType<string | number>, default: '' },
41
+ /** 图片的mode,参考uni-app image组件 */
42
+ imgMode: { type: String as PropType<ImgMode>, default: 'widthFix' },
43
+ /** 自定义样式,对象形式 */
44
+ customStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
45
+ /** 用于显示图片小图标时,图片的宽度,单位rpx */
46
+ width: { type: [String, Number] as PropType<string | number>, default: '' },
47
+ /** 用于显示图片小图标时,图片的高度,单位rpx */
48
+ height: { type: [String, Number] as PropType<string | number>, default: '' },
49
+ /** 用于解决某些情况下,让图标垂直居中的用途,单位rpx */
50
+ top: { type: [String, Number] as PropType<string | number>, default: 0 },
51
+ /** 是否为DecimalIcon */
52
+ showDecimalIcon: { type: Boolean, default: false },
53
+ /** 背景颜色,可接受主题色,仅Decimal时有效 */
54
+ inactiveColor: { type: String, default: '#ececec' },
55
+ /** 显示的百分比,仅Decimal时有效 */
56
+ percent: { type: [Number, String] as PropType<string | number>, default: '50' }
57
+ };
58
+
59
+ /**
60
+ * u-icon 组件 Props 类型
61
+ */
62
+ export type IconProps = ExtractPropTypes<typeof IconProps>;