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
@@ -15,6 +15,7 @@
15
15
 
16
16
  <script setup lang="ts">
17
17
  import { $u } from '../..';
18
+ import { LinkProps } from './types';
18
19
 
19
20
  defineOptions({
20
21
  name: 'u-link'
@@ -32,20 +33,7 @@ defineOptions({
32
33
  * @property {String} mp-tips 各个小程序平台把链接复制到粘贴板后的提示语(默认“链接已复制,请在浏览器打开”)
33
34
  * @example <u-link href="http://www.uviewui.com">蜀道难,难于上青天</u-link>
34
35
  */
35
- const props = defineProps({
36
- /** 文字颜色 */
37
- color: { type: String, default: '#2979ff' },
38
- /** 字体大小,单位rpx */
39
- fontSize: { type: [String, Number], default: 28 },
40
- /** 是否显示下划线 */
41
- underLine: { type: Boolean, default: false },
42
- /** 要跳转的链接 */
43
- href: { type: String, default: '' },
44
- /** 小程序中复制到粘贴板的提示语 */
45
- mpTips: { type: String, default: '链接已复制,请在浏览器打开' },
46
- /** 下划线颜色 */
47
- lineColor: { type: String, default: '' }
48
- });
36
+ const props = defineProps(LinkProps);
49
37
 
50
38
  /**
51
39
  * 打开链接方法
@@ -0,0 +1,35 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ type LoadingMode = 'circle' | 'flower';
4
+
5
+ /**
6
+ * u-loading 组件 props 类型定义
7
+ * @description 加载动画,支持多种模式
8
+ */
9
+ export const LoadingProps = {
10
+ /** 动画的类型 */
11
+ mode: {
12
+ type: String as PropType<LoadingMode>,
13
+ default: 'circle'
14
+ },
15
+ /** 动画的颜色 */
16
+ color: {
17
+ type: String,
18
+ default: '#c7c7c7'
19
+ },
20
+ /** 加载图标的大小,单位rpx */
21
+ size: {
22
+ type: [String, Number] as PropType<string | number>,
23
+ default: '34'
24
+ },
25
+ /** 是否显示动画 */
26
+ show: {
27
+ type: Boolean,
28
+ default: true
29
+ }
30
+ };
31
+
32
+ /**
33
+ * u-loading 组件 props 类型
34
+ */
35
+ export type LoadingProps = ExtractPropTypes<typeof LoadingProps>;
@@ -4,6 +4,7 @@
4
4
 
5
5
  <script setup lang="ts">
6
6
  import { computed } from 'vue';
7
+ import { LoadingProps } from './types';
7
8
 
8
9
  defineOptions({
9
10
  name: 'u-loading'
@@ -19,29 +20,7 @@ defineOptions({
19
20
  * @property {Boolean} show 是否显示动画(默认true)
20
21
  * @example <u-loading mode="circle"></u-loading>
21
22
  */
22
-
23
- const props = defineProps({
24
- /**
25
- * 动画的类型
26
- * @default 'circle'
27
- */
28
- mode: { type: String, default: 'circle' },
29
- /**
30
- * 动画的颜色
31
- * @default '#c7c7c7'
32
- */
33
- color: { type: String, default: '#c7c7c7' },
34
- /**
35
- * 加载图标的大小,单位rpx
36
- * @default '34'
37
- */
38
- size: { type: [String, Number], default: '34' },
39
- /**
40
- * 是否显示动画
41
- * @default true
42
- */
43
- show: { type: Boolean, default: true }
44
- });
23
+ const props = defineProps(LoadingProps);
45
24
 
46
25
  /**
47
26
  * 加载中圆圈动画的样式
@@ -0,0 +1,79 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { LoadmoreIconType, LoadmoreStatus, LoadmoreText } from '../../types/global';
3
+
4
+ /**
5
+ * u-loadmore 组件 props 类型定义
6
+ * @description 加载更多,支持多种状态和自定义文字
7
+ */
8
+
9
+ export const LoadmoreProps = {
10
+ /** 组件背景色 */
11
+ bgColor: {
12
+ type: String,
13
+ default: 'transparent'
14
+ },
15
+ /** 是否显示加载中的图标 */
16
+ icon: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ /** 字体大小 */
21
+ fontSize: {
22
+ type: String,
23
+ default: '28'
24
+ },
25
+ /** 字体颜色 */
26
+ color: {
27
+ type: String,
28
+ default: '#606266'
29
+ },
30
+ /** 组件状态,loadmore-加载前,loading-加载中,nomore-没有更多 */
31
+ status: {
32
+ type: String as PropType<LoadmoreStatus>,
33
+ default: 'loadmore'
34
+ },
35
+ /** 加载中状态的图标,flower-花朵状,circle-圆圈状 */
36
+ iconType: {
37
+ type: String as PropType<LoadmoreIconType>,
38
+ default: 'circle'
39
+ },
40
+ /** 显示的文字 */
41
+ loadText: {
42
+ type: Object as PropType<LoadmoreText>,
43
+ default: () => ({
44
+ loadmore: '加载更多',
45
+ loading: '正在加载...',
46
+ nomore: '没有更多了'
47
+ })
48
+ },
49
+ /** 在“没有更多”状态下,是否显示粗点 */
50
+ isDot: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ /** 加载中显示圆圈动画时,动画的颜色 */
55
+ iconColor: {
56
+ type: String,
57
+ default: '#b7b7b7'
58
+ },
59
+ /** 上边距 */
60
+ marginTop: {
61
+ type: [String, Number] as PropType<string | number>,
62
+ default: 0
63
+ },
64
+ /** 下边距 */
65
+ marginBottom: {
66
+ type: [String, Number] as PropType<string | number>,
67
+ default: 0
68
+ },
69
+ /** 高度,单位rpx */
70
+ height: {
71
+ type: [String, Number] as PropType<string | number>,
72
+ default: 'auto'
73
+ }
74
+ };
75
+
76
+ /**
77
+ * u-loadmore 组件 props 类型
78
+ */
79
+ export type LoadmoreProps = ExtractPropTypes<typeof LoadmoreProps>;
@@ -31,6 +31,7 @@
31
31
  <script setup lang="ts">
32
32
  import { ref, computed } from 'vue';
33
33
  import { $u } from '../..';
34
+ import { LoadmoreProps } from './types';
34
35
 
35
36
  defineOptions({ name: 'u-loadmore' });
36
37
 
@@ -51,73 +52,7 @@ defineOptions({ name: 'u-loadmore' });
51
52
  * @event {Function} loadmore status为loadmore时,点击组件会发出此事件
52
53
  * @example <u-loadmore :status="status" icon-type="iconType" load-text="loadText" />
53
54
  */
54
- const props = defineProps({
55
- // 组件背景色
56
- bgColor: {
57
- type: String,
58
- default: 'transparent'
59
- },
60
- // 是否显示加载中的图标
61
- icon: {
62
- type: Boolean,
63
- default: true
64
- },
65
- // 字体大小
66
- fontSize: {
67
- type: String,
68
- default: '28'
69
- },
70
- // 字体颜色
71
- color: {
72
- type: String,
73
- default: '#606266'
74
- },
75
- // 组件状态,loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
76
- status: {
77
- type: String,
78
- default: 'loadmore'
79
- },
80
- // 加载中状态的图标,flower-花朵状图标,circle-圆圈状图标
81
- iconType: {
82
- type: String,
83
- default: 'circle'
84
- },
85
- // 显示的文字
86
- loadText: {
87
- type: Object as () => { loadmore: string; loading: string; nomore: string },
88
- default: () => ({
89
- loadmore: '加载更多',
90
- loading: '正在加载...',
91
- nomore: '没有更多了'
92
- })
93
- },
94
- // 在“没有更多”状态下,是否显示粗点
95
- isDot: {
96
- type: Boolean,
97
- default: false
98
- },
99
- // 加载中显示圆圈动画时,动画的颜色
100
- iconColor: {
101
- type: String,
102
- default: '#b7b7b7'
103
- },
104
- // 上边距
105
- marginTop: {
106
- type: [String, Number],
107
- default: 0
108
- },
109
- // 下边距
110
- marginBottom: {
111
- type: [String, Number],
112
- default: 0
113
- },
114
- // 高度,单位rpx
115
- height: {
116
- type: [String, Number],
117
- default: 'auto'
118
- }
119
- });
120
-
55
+ const props = defineProps(LoadmoreProps);
121
56
  const emits = defineEmits(['loadmore']);
122
57
 
123
58
  // 粗点
@@ -0,0 +1,43 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-mask 组件 props 类型定义
5
+ * @description 遮罩层,支持自定义样式、缩放、动画等
6
+ */
7
+ export const MaskProps = {
8
+ /** 是否显示遮罩 */
9
+ show: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ /** 层级z-index */
14
+ zIndex: {
15
+ type: [Number, String] as PropType<number | string>,
16
+ default: ''
17
+ },
18
+ /** 用户自定义样式 */
19
+ customStyle: {
20
+ type: Object as PropType<Record<string, any>>,
21
+ default: () => ({})
22
+ },
23
+ /** 遮罩的动画样式,是否使用zoom进行scale进行缩放 */
24
+ zoom: {
25
+ type: Boolean,
26
+ default: true
27
+ },
28
+ /** 遮罩的过渡时间,单位为ms */
29
+ duration: {
30
+ type: [Number, String] as PropType<number | string>,
31
+ default: 300
32
+ },
33
+ /** 是否可以通过点击遮罩进行关闭 */
34
+ maskClickAble: {
35
+ type: Boolean,
36
+ default: true
37
+ }
38
+ };
39
+
40
+ /**
41
+ * u-mask 组件 props 类型
42
+ */
43
+ export type MaskProps = ExtractPropTypes<typeof MaskProps>;
@@ -17,6 +17,7 @@
17
17
  <script setup lang="ts">
18
18
  import { ref, computed, watch } from 'vue';
19
19
  import { $u } from '../..';
20
+ import { MaskProps } from './types';
20
21
 
21
22
  defineOptions({ name: 'u-mask' });
22
23
 
@@ -33,39 +34,7 @@ defineOptions({ name: 'u-mask' });
33
34
  * @event {Function} click mask-click-able为true时,点击遮罩发送此事件
34
35
  * @example <u-mask :show="show" @click="show = false"></u-mask>
35
36
  */
36
- const props = defineProps({
37
- // 是否显示遮罩
38
- show: {
39
- type: Boolean,
40
- default: false
41
- },
42
- // 层级z-index
43
- zIndex: {
44
- type: [Number, String],
45
- default: ''
46
- },
47
- // 用户自定义样式
48
- customStyle: {
49
- type: Object,
50
- default: () => ({})
51
- },
52
- // 遮罩的动画样式, 是否使用zoom进行scale进行缩放
53
- zoom: {
54
- type: Boolean,
55
- default: true
56
- },
57
- // 遮罩的过渡时间,单位为ms
58
- duration: {
59
- type: [Number, String],
60
- default: 300
61
- },
62
- // 是否可以通过点击遮罩进行关闭
63
- maskClickAble: {
64
- type: Boolean,
65
- default: true
66
- }
67
- });
68
-
37
+ const props = defineProps(MaskProps);
69
38
  const emit = defineEmits(['click']);
70
39
 
71
40
  // 缩放动画样式
@@ -0,0 +1,74 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { MessageInputMode } from '../../types/global';
3
+
4
+ /**
5
+ * u-message-input 组件 props 类型定义
6
+ * @description 验证码/短信输入框,支持多种样式
7
+ */
8
+ export const MessageInputProps = {
9
+ /** 最大输入长度 */
10
+ maxlength: {
11
+ type: [Number, String] as PropType<number | string>,
12
+ default: 4
13
+ },
14
+ /** 是否用圆点填充 */
15
+ dotFill: {
16
+ type: Boolean,
17
+ default: false
18
+ },
19
+ /** 显示模式,box-盒子,bottomLine-底部横线,middleLine-中部横线 */
20
+ mode: {
21
+ type: String as PropType<MessageInputMode>,
22
+ default: 'box'
23
+ },
24
+ /** 预置值 */
25
+ value: {
26
+ type: [String, Number] as PropType<string | number>,
27
+ default: ''
28
+ },
29
+ /** 当前激活输入item,是否带有呼吸效果 */
30
+ breathe: {
31
+ type: Boolean,
32
+ default: true
33
+ },
34
+ /** 是否自动获取焦点 */
35
+ focus: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ /** 字体是否加粗 */
40
+ bold: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ /** 字体大小 */
45
+ fontSize: {
46
+ type: [String, Number] as PropType<string | number>,
47
+ default: 60
48
+ },
49
+ /** 激活样式 */
50
+ activeColor: {
51
+ type: String,
52
+ default: '#2979ff'
53
+ },
54
+ /** 未激活的样式 */
55
+ inactiveColor: {
56
+ type: String,
57
+ default: '#606266'
58
+ },
59
+ /** 输入框的大小,单位rpx,宽等于高 */
60
+ width: {
61
+ type: [Number, String] as PropType<number | string>,
62
+ default: '80'
63
+ },
64
+ /** 是否隐藏原生键盘 */
65
+ disabledKeyboard: {
66
+ type: Boolean,
67
+ default: false
68
+ }
69
+ };
70
+
71
+ /**
72
+ * u-message-input 组件 props 类型
73
+ */
74
+ export type MessageInputProps = ExtractPropTypes<typeof MessageInputProps>;
@@ -57,6 +57,7 @@
57
57
 
58
58
  <script setup lang="ts">
59
59
  import { ref, computed, watch } from 'vue';
60
+ import { MessageInputProps } from './types';
60
61
 
61
62
  defineOptions({ name: 'u-message-input' });
62
63
 
@@ -80,68 +81,7 @@ defineOptions({ name: 'u-message-input' });
80
81
  * @event {Function} finish 输入字符个数达maxlength值时触发,见官网说明
81
82
  * @example <u-message-input mode="bottomLine"></u-message-input>
82
83
  */
83
- const props = defineProps({
84
- // 最大输入长度
85
- maxlength: {
86
- type: [Number, String],
87
- default: 4
88
- },
89
- // 是否用圆点填充
90
- dotFill: {
91
- type: Boolean,
92
- default: false
93
- },
94
- // 显示模式,box-盒子模式,bottomLine-横线在底部模式,middleLine-横线在中部模式
95
- mode: {
96
- type: String,
97
- default: 'box'
98
- },
99
- // 预置值
100
- value: {
101
- type: [String, Number],
102
- default: ''
103
- },
104
- // 当前激活输入item,是否带有呼吸效果
105
- breathe: {
106
- type: Boolean,
107
- default: true
108
- },
109
- // 是否自动获取焦点
110
- focus: {
111
- type: Boolean,
112
- default: false
113
- },
114
- // 字体是否加粗
115
- bold: {
116
- type: Boolean,
117
- default: false
118
- },
119
- // 字体大小
120
- fontSize: {
121
- type: [String, Number],
122
- default: 60
123
- },
124
- // 激活样式
125
- activeColor: {
126
- type: String,
127
- default: '#2979ff'
128
- },
129
- // 未激活的样式
130
- inactiveColor: {
131
- type: String,
132
- default: '#606266'
133
- },
134
- // 输入框的大小,单位rpx,宽等于高
135
- width: {
136
- type: [Number, String],
137
- default: '80'
138
- },
139
- // 是否隐藏原生键盘,如果想用自定义键盘的话,需设置此参数为true
140
- disabledKeyboard: {
141
- type: Boolean,
142
- default: false
143
- }
144
- });
84
+ const props = defineProps(MessageInputProps);
145
85
 
146
86
  const emit = defineEmits(['change', 'finish']);
147
87
 
@@ -0,0 +1,118 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-modal 组件 props 类型定义
5
+ * @description 弹窗模态框,支持多种样式和交互
6
+ */
7
+ export const ModalProps = {
8
+ /** 是否显示模态框 */
9
+ modelValue: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ /** 层级z-index */
14
+ zIndex: {
15
+ type: [Number, String] as PropType<number | string>,
16
+ default: ''
17
+ },
18
+ /** 标题 */
19
+ title: {
20
+ type: String,
21
+ default: '提示'
22
+ },
23
+ /** 弹窗宽度 */
24
+ width: {
25
+ type: [Number, String] as PropType<number | string>,
26
+ default: 600
27
+ },
28
+ /** 弹窗内容 */
29
+ content: {
30
+ type: String,
31
+ default: '内容'
32
+ },
33
+ /** 是否显示标题 */
34
+ showTitle: {
35
+ type: Boolean,
36
+ default: true
37
+ },
38
+ /** 是否显示确认按钮 */
39
+ showConfirmButton: {
40
+ type: Boolean,
41
+ default: true
42
+ },
43
+ /** 是否显示取消按钮 */
44
+ showCancelButton: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ /** 确认文案 */
49
+ confirmText: {
50
+ type: String,
51
+ default: '确认'
52
+ },
53
+ /** 取消文案 */
54
+ cancelText: {
55
+ type: String,
56
+ default: '取消'
57
+ },
58
+ /** 确认按钮颜色 */
59
+ confirmColor: {
60
+ type: String,
61
+ default: '#2979ff'
62
+ },
63
+ /** 取消文字颜色 */
64
+ cancelColor: {
65
+ type: String,
66
+ default: '#606266'
67
+ },
68
+ /** 圆角值 */
69
+ borderRadius: {
70
+ type: [Number, String] as PropType<number | string>,
71
+ default: 16
72
+ },
73
+ /** 标题的样式 */
74
+ titleStyle: {
75
+ type: Object as PropType<Record<string, any>>,
76
+ default: () => ({})
77
+ },
78
+ /** 内容的样式 */
79
+ contentStyle: {
80
+ type: Object as PropType<Record<string, any>>,
81
+ default: () => ({})
82
+ },
83
+ /** 取消按钮的样式 */
84
+ cancelStyle: {
85
+ type: Object as PropType<Record<string, any>>,
86
+ default: () => ({})
87
+ },
88
+ /** 确定按钮的样式 */
89
+ confirmStyle: {
90
+ type: Object as PropType<Record<string, any>>,
91
+ default: () => ({})
92
+ },
93
+ /** 是否开启缩放效果 */
94
+ zoom: {
95
+ type: Boolean,
96
+ default: true
97
+ },
98
+ /** 是否异步关闭,只对确定按钮有效 */
99
+ asyncClose: {
100
+ type: Boolean,
101
+ default: false
102
+ },
103
+ /** 是否允许点击遮罩关闭modal */
104
+ maskCloseAble: {
105
+ type: Boolean,
106
+ default: false
107
+ },
108
+ /** 给一个负的margin-top,往上偏移,避免和键盘重合的情况 */
109
+ negativeTop: {
110
+ type: [String, Number] as PropType<number | string>,
111
+ default: 0
112
+ }
113
+ };
114
+
115
+ /**
116
+ * u-modal 组件 props 类型
117
+ */
118
+ export type ModalProps = ExtractPropTypes<typeof ModalProps>;