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
@@ -21,6 +21,7 @@
21
21
  <script setup lang="ts">
22
22
  import { ref, computed, watch, onMounted, getCurrentInstance } from 'vue';
23
23
  import { $u } from '../..';
24
+ import { RateProps } from './types';
24
25
 
25
26
  defineOptions({
26
27
  name: 'u-rate'
@@ -44,130 +45,7 @@ defineOptions({
44
45
  * @event {Function} change 选中的星星发生变化时触发
45
46
  * @example <u-rate :count="count" :current="2"></u-rate>
46
47
  */
47
- const props = defineProps({
48
- /**
49
- * 用于v-model双向绑定选中的星星数量
50
- * 1.4.5版新增
51
- * @default -1
52
- */
53
- modelValue: {
54
- type: [Number, String],
55
- default: -1
56
- },
57
- /**
58
- * 要显示的星星数量
59
- * @default 5
60
- */
61
- count: {
62
- type: [Number, String],
63
- default: 5
64
- },
65
- /**
66
- * 当前需要默认选中的星星(选中的个数)
67
- * 1.4.5后通过value双向绑定,不再建议使用此参数
68
- * @default 0
69
- */
70
- current: {
71
- type: [Number, String],
72
- default: 0
73
- },
74
- /**
75
- * 是否不可选中
76
- * @default false
77
- */
78
- disabled: {
79
- type: Boolean,
80
- default: false
81
- },
82
- /**
83
- * 星星的大小,单位rpx
84
- * @default 32
85
- */
86
- size: {
87
- type: [Number, String],
88
- default: 32
89
- },
90
- /**
91
- * 未选中时的颜色
92
- * @default '#b2b2b2'
93
- */
94
- inactiveColor: {
95
- type: String,
96
- default: '#b2b2b2'
97
- },
98
- /**
99
- * 选中的颜色
100
- * @default '#FA3534'
101
- */
102
- activeColor: {
103
- type: String,
104
- default: '#FA3534'
105
- },
106
- /**
107
- * 星星之间的间距,单位rpx
108
- * @default 10
109
- */
110
- gutter: {
111
- type: [Number, String],
112
- default: 10
113
- },
114
- /**
115
- * 最少能选择的星星个数
116
- * @default 0
117
- */
118
- minCount: {
119
- type: [Number, String],
120
- default: 0
121
- },
122
- /**
123
- * 是否允许半星(功能尚未实现)
124
- * @default false
125
- */
126
- allowHalf: {
127
- type: Boolean,
128
- default: false
129
- },
130
- /**
131
- * 选中时的图标(星星)
132
- * @default 'star-fill'
133
- */
134
- activeIcon: {
135
- type: String,
136
- default: 'star-fill'
137
- },
138
- /**
139
- * 未选中时的图标(星星)
140
- * @default 'star'
141
- */
142
- inactiveIcon: {
143
- type: String,
144
- default: 'star'
145
- },
146
- /**
147
- * 自定义扩展前缀,方便用户扩展自己的图标库
148
- * @default 'uicon'
149
- */
150
- customPrefix: {
151
- type: String,
152
- default: 'uicon'
153
- },
154
- /**
155
- * 分段颜色
156
- * @default []
157
- */
158
- colors: {
159
- type: Array,
160
- default: () => []
161
- },
162
- /**
163
- * 分段图标
164
- * @default []
165
- */
166
- icons: {
167
- type: Array,
168
- default: () => []
169
- }
170
- });
48
+ const props = defineProps(RateProps);
171
49
 
172
50
  const emit = defineEmits(['update:modelValue', 'change']);
173
51
  const instance = getCurrentInstance();
@@ -0,0 +1,35 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * ReadMoreProps 阅读更多 props 类型定义
5
+ * @description 内容较长时收起/展开的场景
6
+ */
7
+ export const ReadMoreProps = {
8
+ /** 默认的显示占位高度,单位为rpx */
9
+ showHeight: { type: [Number, String] as PropType<number | string>, default: 400 },
10
+ /** 展开后是否显示"收起"按钮 */
11
+ toggle: { type: Boolean, default: false },
12
+ /** 关闭时的提示文字 */
13
+ closeText: { type: String, default: '展开阅读全文' },
14
+ /** 展开时的提示文字 */
15
+ openText: { type: String, default: '收起' },
16
+ /** 提示的文字颜色 */
17
+ color: { type: String, default: '#2979ff' },
18
+ /** 提示文字的大小 */
19
+ fontSize: { type: [String, Number] as PropType<number | string>, default: 28 },
20
+ /** 是否显示阴影 */
21
+ shadowStyle: {
22
+ type: Object as PropType<Record<string, any>>,
23
+ default: () => ({
24
+ backgroundImage: 'linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #fff 80%)',
25
+ paddingTop: '300rpx',
26
+ marginTop: '-300rpx'
27
+ })
28
+ },
29
+ /** 段落首行缩进的字符个数 */
30
+ textIndent: { type: String, default: '2em' },
31
+ /** open和close事件时,将此参数返回在回调参数中 */
32
+ index: { type: [Number, String] as PropType<number | string>, default: '' }
33
+ };
34
+
35
+ export type ReadMoreProps = ExtractPropTypes<typeof ReadMoreProps>;
@@ -30,6 +30,7 @@
30
30
  <script setup lang="ts">
31
31
  import { ref, computed, watch, onMounted, nextTick, getCurrentInstance } from 'vue';
32
32
  import { $u } from '../..';
33
+ import { ReadMoreProps } from './types';
33
34
 
34
35
  defineOptions({ name: 'u-read-more' });
35
36
 
@@ -51,57 +52,7 @@ defineOptions({ name: 'u-read-more' });
51
52
  * @example <u-read-more><rich-text :nodes="content"></rich-text></u-read-more>
52
53
  */
53
54
 
54
- const props = defineProps({
55
- /** 默认的显示占位高度,单位为rpx */
56
- showHeight: {
57
- type: [Number, String],
58
- default: 400
59
- },
60
- /** 展开后是否显示"收起"按钮 */
61
- toggle: {
62
- type: Boolean,
63
- default: false
64
- },
65
- /** 关闭时的提示文字 */
66
- closeText: {
67
- type: String,
68
- default: '展开阅读全文'
69
- },
70
- /** 展开时的提示文字 */
71
- openText: {
72
- type: String,
73
- default: '收起'
74
- },
75
- /** 提示的文字颜色 */
76
- color: {
77
- type: String,
78
- default: '#2979ff'
79
- },
80
- /** 提示文字的大小 */
81
- fontSize: {
82
- type: [String, Number],
83
- default: 28
84
- },
85
- /** 是否显示阴影 */
86
- shadowStyle: {
87
- type: Object as () => Record<string, any>,
88
- default: () => ({
89
- backgroundImage: 'linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #fff 80%)',
90
- paddingTop: '300rpx',
91
- marginTop: '-300rpx'
92
- })
93
- },
94
- /** 段落首行缩进的字符个数 */
95
- textIndent: {
96
- type: String,
97
- default: '2em'
98
- },
99
- /** open和close事件时,将此参数返回在回调参数中 */
100
- index: {
101
- type: [Number, String],
102
- default: ''
103
- }
104
- });
55
+ const props = defineProps(ReadMoreProps);
105
56
 
106
57
  const emit = defineEmits(['open', 'close']);
107
58
 
@@ -0,0 +1,20 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { RowAlign, RowJustify } from '../../types/global';
3
+
4
+ /**
5
+ * RowProps 行布局 props 类型定义
6
+ * @description 12分栏布局,快速创建布局
7
+ */
8
+
9
+ export const RowProps = {
10
+ /** 给col添加间距,左右边距各占一半 */
11
+ gutter: { type: [String, Number] as PropType<number | string>, default: 20 },
12
+ /** 水平排列方式,可选值为`start`(或`flex-start`)、`end`(或`flex-end`)、`center`、`around`(或`space-around`)、`between`(或`space-between`) */
13
+ justify: { type: String as PropType<RowJustify>, default: 'start' },
14
+ /** 垂直对齐方式,可选值为top、center、bottom */
15
+ align: { type: String as PropType<RowAlign>, default: 'center' },
16
+ /** 是否阻止事件传播 */
17
+ stop: { type: Boolean, default: true }
18
+ };
19
+
20
+ export type RowProps = ExtractPropTypes<typeof RowProps>;
@@ -13,6 +13,7 @@
13
13
 
14
14
  <script setup lang="ts">
15
15
  import { computed, provide } from 'vue';
16
+ import { RowProps } from './types';
16
17
 
17
18
  defineOptions({
18
19
  name: 'u-row'
@@ -30,16 +31,7 @@ defineOptions({
30
31
 
31
32
  const emit = defineEmits<{ (e: 'click'): void }>();
32
33
 
33
- const props = defineProps({
34
- /** 给col添加间距,左右边距各占一半 */
35
- gutter: { type: [String, Number], default: 20 },
36
- /** 水平排列方式,可选值为`start`(或`flex-start`)、`end`(或`flex-end`)、`center`、`around`(或`space-around`)、`between`(或`space-between`) */
37
- justify: { type: String, default: 'start' },
38
- /** 垂直对齐方式,可选值为top、center、bottom */
39
- align: { type: String, default: 'center' },
40
- /** 是否阻止事件传播 */
41
- stop: { type: Boolean, default: true }
42
- });
34
+ const props = defineProps(RowProps);
43
35
 
44
36
  // 提供 gutter 给子组件 u-col 使用
45
37
  provide('u-row-gutter', props.gutter);
@@ -0,0 +1,39 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { PlayState, ThemeType } from '../../types/global';
3
+
4
+ /**
5
+ * RowNoticeProps 水平滚动通告栏 props 类型定义
6
+ * @description 水平滚动通告栏,支持主题、图标、关闭等
7
+ */
8
+ export const RowNoticeProps = {
9
+ /** 显示的内容,数组 */
10
+ list: { type: Array as PropType<string[]>, default: () => [] },
11
+ /** 显示的主题,success|error|primary|info|warning|none */
12
+ type: { type: String as PropType<ThemeType | 'none'>, default: 'warning' },
13
+ /** 是否显示左侧的音量图标 */
14
+ volumeIcon: { type: Boolean, default: true },
15
+ /** 是否显示右侧的右箭头图标 */
16
+ moreIcon: { type: Boolean, default: false },
17
+ /** 是否显示右侧的关闭图标 */
18
+ closeIcon: { type: Boolean, default: false },
19
+ /** 是否自动播放 */
20
+ autoplay: { type: Boolean, default: true },
21
+ /** 文字颜色,各图标也会使用文字颜色 */
22
+ color: { type: String, default: '' },
23
+ /** 背景颜色 */
24
+ bgColor: { type: String, default: '' },
25
+ /** 是否显示 */
26
+ show: { type: Boolean, default: true },
27
+ /** 字体大小,单位rpx */
28
+ fontSize: { type: [Number, String] as PropType<number | string>, default: 26 },
29
+ /** 音量喇叭的大小 */
30
+ volumeSize: { type: [Number, String] as PropType<number | string>, default: 34 },
31
+ /** 水平滚动时的滚动速度,即每秒滚动多少rpx */
32
+ speed: { type: [Number, String] as PropType<number | string>, default: 160 },
33
+ /** 播放状态,play-播放,paused-暂停 */
34
+ playState: { type: String as PropType<PlayState>, default: 'play' },
35
+ /** 通知的边距 */
36
+ padding: { type: [Number, String] as PropType<number | string>, default: '18rpx 24rpx' }
37
+ };
38
+
39
+ export type RowNoticeProps = ExtractPropTypes<typeof RowNoticeProps>;
@@ -19,6 +19,7 @@
19
19
 
20
20
  <script setup lang="ts">
21
21
  import { ref, computed, watch, onMounted, nextTick, getCurrentInstance } from 'vue';
22
+ import { RowNoticeProps } from './types';
22
23
 
23
24
  defineOptions({ name: 'u-row-notice' });
24
25
 
@@ -40,78 +41,7 @@ defineOptions({ name: 'u-row-notice' });
40
41
  * @property {String|Number} padding 通知的边距
41
42
  */
42
43
 
43
- const props = defineProps({
44
- /** 显示的内容,数组 */
45
- list: {
46
- type: Array as () => string[],
47
- default: () => []
48
- },
49
- /** 显示的主题,success|error|primary|info|warning|none */
50
- type: {
51
- type: String,
52
- default: 'warning'
53
- },
54
- /** 是否显示左侧的音量图标 */
55
- volumeIcon: {
56
- type: Boolean,
57
- default: true
58
- },
59
- /** 是否显示右侧的右箭头图标 */
60
- moreIcon: {
61
- type: Boolean,
62
- default: false
63
- },
64
- /** 是否显示右侧的关闭图标 */
65
- closeIcon: {
66
- type: Boolean,
67
- default: false
68
- },
69
- /** 是否自动播放 */
70
- autoplay: {
71
- type: Boolean,
72
- default: true
73
- },
74
- /** 文字颜色,各图标也会使用文字颜色 */
75
- color: {
76
- type: String,
77
- default: ''
78
- },
79
- /** 背景颜色 */
80
- bgColor: {
81
- type: String,
82
- default: ''
83
- },
84
- /** 是否显示 */
85
- show: {
86
- type: Boolean,
87
- default: true
88
- },
89
- /** 字体大小,单位rpx */
90
- fontSize: {
91
- type: [Number, String],
92
- default: 26
93
- },
94
- /** 音量喇叭的大小 */
95
- volumeSize: {
96
- type: [Number, String],
97
- default: 34
98
- },
99
- /** 水平滚动时的滚动速度,即每秒滚动多少rpx */
100
- speed: {
101
- type: [Number, String],
102
- default: 160
103
- },
104
- /** 播放状态,play-播放,paused-暂停 */
105
- playState: {
106
- type: String,
107
- default: 'play'
108
- },
109
- /** 通知的边距 */
110
- padding: {
111
- type: [Number, String],
112
- default: '18rpx 24rpx'
113
- }
114
- });
44
+ const props = defineProps(RowNoticeProps);
115
45
 
116
46
  const emit = defineEmits<{ (e: 'click'): void; (e: 'close'): void; (e: 'getMore'): void }>();
117
47
  const instance = getCurrentInstance();
@@ -0,0 +1,53 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { InputAlign, SearchShape } from '../../types/global';
3
+
4
+ /**
5
+ * SearchProps 搜索框 props 类型定义
6
+ * @description 集成常见搜索框功能,开箱即用
7
+ */
8
+ export const SearchProps = {
9
+ /** 搜索框形状,round-圆形,square-方形 */
10
+ shape: { type: String as PropType<SearchShape>, default: 'round' },
11
+ /** 搜索框背景色,默认值#f2f2f2 */
12
+ bgColor: { type: String, default: '#f2f2f2' },
13
+ /** 占位提示文字 */
14
+ placeholder: { type: String, default: '请输入关键字' },
15
+ /** 是否启用清除控件 */
16
+ clearabled: { type: Boolean, default: true },
17
+ /** 是否自动聚焦 */
18
+ focus: { type: Boolean, default: false },
19
+ /** 是否在搜索框右侧显示取消按钮 */
20
+ showAction: { type: Boolean, default: true },
21
+ /** 右边控件的样式 */
22
+ actionStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
23
+ /** 取消按钮文字 */
24
+ actionText: { type: String, default: '搜索' },
25
+ /** 输入框内容对齐方式,可选值为 left|center|right */
26
+ inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
27
+ /** 是否启用输入框 */
28
+ disabled: { type: Boolean, default: false },
29
+ /** 开启showAction时,是否在input获取焦点时才显示 */
30
+ animation: { type: Boolean, default: false },
31
+ /** 边框颜色,只要配置了颜色,才会有边框 */
32
+ borderColor: { type: String, default: 'none' },
33
+ /** 输入框的初始化内容 */
34
+ modelValue: { type: String, default: '' },
35
+ /** 搜索框高度,单位rpx */
36
+ height: { type: [Number, String] as PropType<number | string>, default: 64 },
37
+ /** input输入框的样式,可以定义文字颜色,大小等,对象形式 */
38
+ inputStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
39
+ /** 输入框最大能输入的长度,-1为不限制长度(来自uniapp文档) */
40
+ maxlength: { type: [Number, String] as PropType<number | string>, default: '-1' },
41
+ /** 搜索图标的颜色,默认同输入框字体颜色 */
42
+ searchIconColor: { type: String, default: '' },
43
+ /** 输入框字体颜色 */
44
+ color: { type: String, default: '#606266' },
45
+ /** placeholder的颜色 */
46
+ placeholderColor: { type: String, default: '#909399' },
47
+ /** 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30rpx"、"30rpx 20rpx"等写法 */
48
+ margin: { type: String, default: '0' },
49
+ /** 左边输入框的图标,可以为uView图标名称或图片路径 */
50
+ searchIcon: { type: String, default: 'search' }
51
+ };
52
+
53
+ export type SearchProps = ExtractPropTypes<typeof SearchProps>;
@@ -52,6 +52,7 @@
52
52
 
53
53
  <script setup lang="ts">
54
54
  import { ref, computed, watch, nextTick } from 'vue';
55
+ import { SearchProps } from './types';
55
56
 
56
57
  defineOptions({ name: 'u-search' });
57
58
 
@@ -88,50 +89,7 @@ defineOptions({ name: 'u-search' });
88
89
  * @example <u-search placeholder="日照香炉生紫烟" v-model="keyword"></u-search>
89
90
  */
90
91
 
91
- const props = defineProps({
92
- /** 搜索框形状,round-圆形,square-方形 */
93
- shape: { type: String, default: 'round' },
94
- /** 搜索框背景色,默认值#f2f2f2 */
95
- bgColor: { type: String, default: '#f2f2f2' },
96
- /** 占位提示文字 */
97
- placeholder: { type: String, default: '请输入关键字' },
98
- /** 是否启用清除控件 */
99
- clearabled: { type: Boolean, default: true },
100
- /** 是否自动聚焦 */
101
- focus: { type: Boolean, default: false },
102
- /** 是否在搜索框右侧显示取消按钮 */
103
- showAction: { type: Boolean, default: true },
104
- /** 右边控件的样式 */
105
- actionStyle: { type: Object, default: () => ({}) },
106
- /** 取消按钮文字 */
107
- actionText: { type: String, default: '搜索' },
108
- /** 输入框内容对齐方式,可选值为 left|center|right */
109
- inputAlign: { type: String, default: 'left' },
110
- /** 是否启用输入框 */
111
- disabled: { type: Boolean, default: false },
112
- /** 开启showAction时,是否在input获取焦点时才显示 */
113
- animation: { type: Boolean, default: false },
114
- /** 边框颜色,只要配置了颜色,才会有边框 */
115
- borderColor: { type: String, default: 'none' },
116
- /** 输入框的初始化内容 */
117
- modelValue: { type: String, default: '' },
118
- /** 搜索框高度,单位rpx */
119
- height: { type: [Number, String], default: 64 },
120
- /** input输入框的样式,可以定义文字颜色,大小等,对象形式 */
121
- inputStyle: { type: Object, default: () => ({}) },
122
- /** 输入框最大能输入的长度,-1为不限制长度(来自uniapp文档) */
123
- maxlength: { type: [Number, String], default: '-1' },
124
- /** 搜索图标的颜色,默认同输入框字体颜色 */
125
- searchIconColor: { type: String, default: '' },
126
- /** 输入框字体颜色 */
127
- color: { type: String, default: '#606266' },
128
- /** placeholder的颜色 */
129
- placeholderColor: { type: String, default: '#909399' },
130
- /** 组件与其他上下左右元素之间的距离,带单位的字符串形式,如"30rpx"、"30rpx 20rpx"等写法 */
131
- margin: { type: String, default: '0' },
132
- /** 左边输入框的图标,可以为uView图标名称或图片路径 */
133
- searchIcon: { type: String, default: 'search' }
134
- });
92
+ const props = defineProps(SearchProps);
135
93
 
136
94
  const emit = defineEmits(['update:modelValue', 'change', 'search', 'custom', 'clear', 'focus', 'blur', 'click']);
137
95
 
@@ -0,0 +1,32 @@
1
+ import { type ExtractPropTypes, type PropType } from 'vue';
2
+
3
+ /**
4
+ * section 组件 props 类型定义
5
+ * @description 供 u-section 组件 props 使用
6
+ */
7
+ export type FontSize = string | number;
8
+
9
+ export const SectionProps = {
10
+ /** 标题信息 */
11
+ title: { type: String, default: '' },
12
+ /** 右边副标题内容 */
13
+ subTitle: { type: String, default: '更多' },
14
+ /** 是否显示右边的内容 */
15
+ right: { type: Boolean, default: true },
16
+ /** 主标题的字体大小 */
17
+ fontSize: { type: [Number, String] as PropType<FontSize>, default: 28 },
18
+ /** 主标题是否加粗 */
19
+ bold: { type: Boolean, default: true },
20
+ /** 主标题的颜色 */
21
+ color: { type: String, default: '#303133' },
22
+ /** 右边副标题的颜色 */
23
+ subColor: { type: String, default: '#909399' },
24
+ /** 是否显示左边的竖条 */
25
+ showLine: { type: Boolean, default: true },
26
+ /** 左边竖线的颜色 */
27
+ lineColor: { type: String, default: '' },
28
+ /** 是否显示右边箭头 */
29
+ arrow: { type: Boolean, default: true }
30
+ };
31
+
32
+ export type SectionProps = ExtractPropTypes<typeof SectionProps>;
@@ -38,6 +38,7 @@
38
38
 
39
39
  <script setup lang="ts">
40
40
  import { computed } from 'vue';
41
+ import { SectionProps } from './types';
41
42
  import { $u } from '../..';
42
43
 
43
44
  defineOptions({ name: 'u-section' });
@@ -60,58 +61,7 @@ defineOptions({ name: 'u-section' });
60
61
  * @example <u-section title="今日热门" :right="false"></u-section>
61
62
  */
62
63
 
63
- const props = defineProps({
64
- /** 标题信息 */
65
- title: {
66
- type: String,
67
- default: ''
68
- },
69
- /** 右边副标题内容 */
70
- subTitle: {
71
- type: String,
72
- default: '更多'
73
- },
74
- /** 是否显示右边的内容 */
75
- right: {
76
- type: Boolean,
77
- default: true
78
- },
79
- /** 主标题的字体大小 */
80
- fontSize: {
81
- type: [Number, String],
82
- default: 28
83
- },
84
- /** 主标题是否加粗 */
85
- bold: {
86
- type: Boolean,
87
- default: true
88
- },
89
- /** 主标题的颜色 */
90
- color: {
91
- type: String,
92
- default: '#303133'
93
- },
94
- /** 右边副标题的颜色 */
95
- subColor: {
96
- type: String,
97
- default: '#909399'
98
- },
99
- /** 是否显示左边的竖条 */
100
- showLine: {
101
- type: Boolean,
102
- default: true
103
- },
104
- /** 左边竖线的颜色 */
105
- lineColor: {
106
- type: String,
107
- default: ''
108
- },
109
- /** 是否显示右边箭头 */
110
- arrow: {
111
- type: Boolean,
112
- default: true
113
- }
114
- });
64
+ const props = defineProps(SectionProps);
115
65
 
116
66
  const emit = defineEmits(['click']);
117
67
 
@@ -0,0 +1,43 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { SelectMode } from '../../types/global';
3
+
4
+ /**
5
+ * SelectProps 列选择器 props 类型定义
6
+ * @description 用于单列、多列、多列联动的选择场景
7
+ */
8
+ export const SelectProps = {
9
+ /** 列数据 */
10
+ list: { type: Array as PropType<any[]>, default: () => [] },
11
+ /** 是否显示边框 */
12
+ border: { type: Boolean, default: true },
13
+ /** 通过双向绑定控制组件的弹出与收起 */
14
+ modelValue: { type: Boolean, default: false },
15
+ /** "取消"按钮的颜色 */
16
+ cancelColor: { type: String, default: '#606266' },
17
+ /** "确定"按钮的颜色 */
18
+ confirmColor: { type: String, default: '#2979ff' },
19
+ /** 弹出的z-index值 */
20
+ zIndex: { type: [String, Number] as PropType<string | number>, default: 0 },
21
+ /** 是否开启底部安全区适配 */
22
+ safeAreaInsetBottom: { type: Boolean, default: false },
23
+ /** 是否允许通过点击遮罩关闭Picker */
24
+ maskCloseAble: { type: Boolean, default: true },
25
+ /** 提供的默认选中的下标 */
26
+ defaultValue: { type: Array as PropType<number[]>, default: () => [0] },
27
+ /** 模式选择,single-column-单列,mutil-column-多列,mutil-column-auto-多列联动 */
28
+ mode: { type: String as PropType<SelectMode>, default: 'single-column' },
29
+ /** 自定义value属性名 */
30
+ valueName: { type: String, default: 'value' },
31
+ /** 自定义label属性名 */
32
+ labelName: { type: String, default: 'label' },
33
+ /** 自定义多列联动模式的children属性名 */
34
+ childName: { type: String, default: 'children' },
35
+ /** 顶部标题 */
36
+ title: { type: String, default: '' },
37
+ /** 取消按钮的文字 */
38
+ cancelText: { type: String, default: '取消' },
39
+ /** 确认按钮的文字 */
40
+ confirmText: { type: String, default: '确认' }
41
+ };
42
+
43
+ export type SelectProps = ExtractPropTypes<typeof SelectProps>;