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
@@ -48,6 +48,7 @@
48
48
 
49
49
  <script setup lang="ts">
50
50
  import { ref, computed, watch, useSlots } from 'vue';
51
+ import { ModalProps } from './types';
51
52
 
52
53
  defineOptions({
53
54
  name: 'u-modal'
@@ -83,92 +84,7 @@ defineOptions({
83
84
  * @example <u-modal :src="title" :content="content"></u-modal>
84
85
  */
85
86
 
86
- const props = defineProps({
87
- /**
88
- * 是否显示模态框
89
- */
90
- modelValue: { type: Boolean, default: false },
91
- /**
92
- * 层级z-index
93
- */
94
- zIndex: { type: [Number, String], default: '' },
95
- /**
96
- * 标题
97
- */
98
- title: { type: String, default: '提示' },
99
- /**
100
- * 弹窗宽度,可以是数值(rpx),百分比,auto等
101
- */
102
- width: { type: [Number, String], default: 600 },
103
- /**
104
- * 弹窗内容
105
- */
106
- content: { type: String, default: '内容' },
107
- /**
108
- * 是否显示标题
109
- */
110
- showTitle: { type: Boolean, default: true },
111
- /**
112
- * 是否显示确认按钮
113
- */
114
- showConfirmButton: { type: Boolean, default: true },
115
- /**
116
- * 是否显示取消按钮
117
- */
118
- showCancelButton: { type: Boolean, default: false },
119
- /**
120
- * 确认文案
121
- */
122
- confirmText: { type: String, default: '确认' },
123
- /**
124
- * 取消文案
125
- */
126
- cancelText: { type: String, default: '取消' },
127
- /**
128
- * 确认按钮颜色
129
- */
130
- confirmColor: { type: String, default: '#2979ff' },
131
- /**
132
- * 取消文字颜色
133
- */
134
- cancelColor: { type: String, default: '#606266' },
135
- /**
136
- * 圆角值
137
- */
138
- borderRadius: { type: [Number, String], default: 16 },
139
- /**
140
- * 标题的样式
141
- */
142
- titleStyle: { type: Object, default: () => ({}) },
143
- /**
144
- * 内容的样式
145
- */
146
- contentStyle: { type: Object, default: () => ({}) },
147
- /**
148
- * 取消按钮的样式
149
- */
150
- cancelStyle: { type: Object, default: () => ({}) },
151
- /**
152
- * 确定按钮的样式
153
- */
154
- confirmStyle: { type: Object, default: () => ({}) },
155
- /**
156
- * 是否开启缩放效果
157
- */
158
- zoom: { type: Boolean, default: true },
159
- /**
160
- * 是否异步关闭,只对确定按钮有效
161
- */
162
- asyncClose: { type: Boolean, default: false },
163
- /**
164
- * 是否允许点击遮罩关闭modal
165
- */
166
- maskCloseAble: { type: Boolean, default: false },
167
- /**
168
- * 给一个负的margin-top,往上偏移,避免和键盘重合的情况
169
- */
170
- negativeTop: { type: [String, Number], default: 0 }
171
- });
87
+ const props = defineProps(ModalProps);
172
88
  const emit = defineEmits(['update:modelValue', 'confirm', 'cancel']);
173
89
  const slots = useSlots();
174
90
 
@@ -0,0 +1,103 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-navbar 组件 props 类型定义
5
+ * @description 自定义导航栏,支持多种样式
6
+ */
7
+ export const NavbarProps = {
8
+ /** 导航栏高度,单位px,非rpx */
9
+ height: {
10
+ type: [String, Number] as PropType<string | number>,
11
+ default: ''
12
+ },
13
+ /** 返回箭头的颜色 */
14
+ backIconColor: {
15
+ type: String,
16
+ default: '#606266'
17
+ },
18
+ /** 左边返回的图标 */
19
+ backIconName: {
20
+ type: String,
21
+ default: 'nav-back'
22
+ },
23
+ /** 左边返回图标的大小,rpx */
24
+ backIconSize: {
25
+ type: [String, Number] as PropType<string | number>,
26
+ default: '44'
27
+ },
28
+ /** 返回的文字提示 */
29
+ backText: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ /** 返回的文字的 样式 */
34
+ backTextStyle: {
35
+ type: Object as PropType<Record<string, any>>,
36
+ default: () => ({ color: '#606266' })
37
+ },
38
+ /** 导航栏标题 */
39
+ title: {
40
+ type: String,
41
+ default: ''
42
+ },
43
+ /** 标题的宽度,单位rpx */
44
+ titleWidth: {
45
+ type: [String, Number] as PropType<string | number>,
46
+ default: '250'
47
+ },
48
+ /** 标题的颜色 */
49
+ titleColor: {
50
+ type: String,
51
+ default: '#606266'
52
+ },
53
+ /** 标题字体是否加粗 */
54
+ titleBold: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ /** 标题的字体大小 */
59
+ titleSize: {
60
+ type: [String, Number] as PropType<string | number>,
61
+ default: 32
62
+ },
63
+ /** 是否显示导航栏左边返回图标和辅助文字 */
64
+ isBack: {
65
+ type: [Boolean, String] as PropType<boolean | string>,
66
+ default: true
67
+ },
68
+ /** 导航栏背景设置 */
69
+ background: {
70
+ type: Object as PropType<Record<string, any>>,
71
+ default: () => ({ background: '#ffffff' })
72
+ },
73
+ /** 导航栏是否固定在顶部 */
74
+ isFixed: {
75
+ type: Boolean,
76
+ default: true
77
+ },
78
+ /** 是否沉浸式,允许fixed定位后导航栏塌陷,仅fixed定位下生效 */
79
+ immersive: {
80
+ type: Boolean,
81
+ default: false
82
+ },
83
+ /** 是否显示导航栏的下边框 */
84
+ borderBottom: {
85
+ type: Boolean,
86
+ default: true
87
+ },
88
+ /** 固定在顶部时的z-index值 */
89
+ zIndex: {
90
+ type: [String, Number] as PropType<string | number>,
91
+ default: ''
92
+ },
93
+ /** 自定义返回逻辑方法 */
94
+ customBack: {
95
+ type: Function as PropType<() => void>,
96
+ default: null
97
+ }
98
+ };
99
+
100
+ /**
101
+ * u-navbar 组件 props 类型
102
+ */
103
+ export type NavbarProps = ExtractPropTypes<typeof NavbarProps>;
@@ -41,6 +41,7 @@
41
41
  <script setup lang="ts">
42
42
  import { ref, computed } from 'vue';
43
43
  import { $u } from '../..';
44
+ import { NavbarProps } from './types';
44
45
 
45
46
  defineOptions({ name: 'u-navbar' });
46
47
 
@@ -67,96 +68,7 @@ defineOptions({ name: 'u-navbar' });
67
68
  * @property {Boolean} border-bottom 导航栏底部是否显示下边框,如定义了较深的背景颜色,可取消此值(默认true)
68
69
  * @example <u-navbar back-text="返回" title="剑未配妥,出门已是江湖"></u-navbar>
69
70
  */
70
- const props = defineProps({
71
- // 导航栏高度,单位px,非rpx
72
- height: {
73
- type: [String, Number],
74
- default: ''
75
- },
76
- // 返回箭头的颜色
77
- backIconColor: {
78
- type: String,
79
- default: '#606266'
80
- },
81
- // 左边返回的图标
82
- backIconName: {
83
- type: String,
84
- default: 'nav-back'
85
- },
86
- // 左边返回图标的大小,rpx
87
- backIconSize: {
88
- type: [String, Number],
89
- default: '44'
90
- },
91
- // 返回的文字提示
92
- backText: {
93
- type: String,
94
- default: ''
95
- },
96
- // 返回的文字的 样式
97
- backTextStyle: {
98
- type: Object,
99
- default: () => ({ color: '#606266' })
100
- },
101
- // 导航栏标题
102
- title: {
103
- type: String,
104
- default: ''
105
- },
106
- // 标题的宽度,如果需要自定义右侧内容,且右侧内容很多时,可能需要减少这个宽度,单位rpx
107
- titleWidth: {
108
- type: [String, Number],
109
- default: '250'
110
- },
111
- // 标题的颜色
112
- titleColor: {
113
- type: String,
114
- default: '#606266'
115
- },
116
- // 标题字体是否加粗
117
- titleBold: {
118
- type: Boolean,
119
- default: false
120
- },
121
- // 标题的字体大小
122
- titleSize: {
123
- type: [String, Number],
124
- default: 32
125
- },
126
- isBack: {
127
- type: [Boolean, String],
128
- default: true
129
- },
130
- // 对象形式,因为用户可能定义一个纯色,或者线性渐变的颜色
131
- background: {
132
- type: Object,
133
- default: () => ({ background: '#ffffff' })
134
- },
135
- // 导航栏是否固定在顶部
136
- isFixed: {
137
- type: Boolean,
138
- default: true
139
- },
140
- // 是否沉浸式,允许fixed定位后导航栏塌陷,仅fixed定位下生效
141
- immersive: {
142
- type: Boolean,
143
- default: false
144
- },
145
- // 是否显示导航栏的下边框
146
- borderBottom: {
147
- type: Boolean,
148
- default: true
149
- },
150
- zIndex: {
151
- type: [String, Number],
152
- default: ''
153
- },
154
- // 自定义返回逻辑
155
- customBack: {
156
- type: Function,
157
- default: null
158
- }
159
- });
71
+ const props = defineProps(NavbarProps);
160
72
  // 获取系统状态栏的高度
161
73
  const systemInfo = uni.getSystemInfoSync();
162
74
  let menuButtonInfo: any = {};
@@ -0,0 +1,28 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-no-network 组件 props 类型定义
5
+ * @description 无网络提示,支持自定义图片、提示语、z-index
6
+ */
7
+ export const NoNetworkProps = {
8
+ /** 页面文字提示 */
9
+ tips: {
10
+ type: String,
11
+ default: '哎呀,网络信号丢失'
12
+ },
13
+ /** 一个z-index值,用于设置没有网络这个组件的层次 */
14
+ zIndex: {
15
+ type: [Number, String] as PropType<number | string>,
16
+ default: ''
17
+ },
18
+ /** 没有网络的图片提示 */
19
+ image: {
20
+ type: String,
21
+ default: ''
22
+ }
23
+ };
24
+
25
+ /**
26
+ * u-no-network 组件 props 类型
27
+ */
28
+ export type NoNetworkProps = ExtractPropTypes<typeof NoNetworkProps>;
@@ -18,6 +18,7 @@
18
18
  import { ref, computed, onMounted } from 'vue';
19
19
  import { imageSrc } from './image';
20
20
  import { $u } from '../..';
21
+ import { NoNetworkProps } from './types';
21
22
 
22
23
  defineOptions({ name: 'u-no-network' });
23
24
 
@@ -32,29 +33,7 @@ defineOptions({ name: 'u-no-network' });
32
33
  * @example <u-no-network></u-no-network>
33
34
  */
34
35
 
35
- const props = defineProps({
36
- /**
37
- * 页面文字提示
38
- */
39
- tips: {
40
- type: String,
41
- default: '哎呀,网络信号丢失'
42
- },
43
- /**
44
- * 一个z-index值,用于设置没有网络这个组件的层次,因为页面可能会有其他定位的元素层级过高,导致此组件被覆盖
45
- */
46
- zIndex: {
47
- type: [Number, String],
48
- default: ''
49
- },
50
- /**
51
- * image 没有网络的图片提示
52
- */
53
- image: {
54
- type: String,
55
- default: imageSrc
56
- }
57
- });
36
+ const props = defineProps(NoNetworkProps);
58
37
 
59
38
  const isConnected = ref(true); // 是否有网络连接
60
39
  const networkType = ref<string>('none'); // 网络类型
@@ -0,0 +1,111 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { Direction, PlayState, ThemeType } from '../../types/global';
3
+
4
+ /**
5
+ * NoticeBarProps 滚动通知 props 类型定义
6
+ * @description 滚动通告场景,有多种模式可供选择
7
+ */
8
+ export const NoticeBarProps = {
9
+ /** 滚动内容,数组形式 */
10
+ list: {
11
+ type: Array as PropType<string[]>,
12
+ default: () => []
13
+ },
14
+ /** 显示的主题,success|error|primary|info|warning */
15
+ type: {
16
+ type: String as PropType<ThemeType>,
17
+ default: 'warning'
18
+ },
19
+ /** 是否显示左侧的音量图标 */
20
+ volumeIcon: {
21
+ type: Boolean,
22
+ default: true
23
+ },
24
+ /** 音量喇叭的大小 */
25
+ volumeSize: {
26
+ type: [Number, String] as PropType<number | string>,
27
+ default: 34
28
+ },
29
+ /** 是否显示右侧的右箭头图标 */
30
+ moreIcon: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ /** 是否显示右侧的关闭图标 */
35
+ closeIcon: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ /** 是否自动播放 */
40
+ autoplay: {
41
+ type: Boolean,
42
+ default: true
43
+ },
44
+ /** 文字颜色,各图标也会使用文字颜色 */
45
+ color: {
46
+ type: String,
47
+ default: ''
48
+ },
49
+ /** 背景颜色 */
50
+ bgColor: {
51
+ type: String,
52
+ default: ''
53
+ },
54
+ /** 滚动方向,horizontal-水平滚动,vertical-垂直滚动 */
55
+ mode: {
56
+ type: String as PropType<Direction>,
57
+ default: 'horizontal'
58
+ },
59
+ /** 是否显示 */
60
+ show: {
61
+ type: Boolean,
62
+ default: true
63
+ },
64
+ /** 字体大小,单位rpx */
65
+ fontSize: {
66
+ type: [Number, String] as PropType<number | string>,
67
+ default: 28
68
+ },
69
+ /** 滚动一个周期的时间长,单位ms */
70
+ duration: {
71
+ type: [Number, String] as PropType<number | string>,
72
+ default: 2000
73
+ },
74
+ /** 水平滚动时的滚动速度,即每秒滚动多少rpx */
75
+ speed: {
76
+ type: [Number, String] as PropType<number | string>,
77
+ default: 160
78
+ },
79
+ /** 水平滚动时,是否采用衔接形式滚动 */
80
+ isCircular: {
81
+ type: Boolean,
82
+ default: true
83
+ },
84
+ /** 播放状态,play-播放,paused-暂停 */
85
+ playState: {
86
+ type: String as PropType<PlayState>,
87
+ default: 'play'
88
+ },
89
+ /** 是否禁止用手滑动切换 */
90
+ disableTouch: {
91
+ type: Boolean,
92
+ default: true
93
+ },
94
+ /** 滚动通知设置圆角 */
95
+ borderRadius: {
96
+ type: [Number, String] as PropType<number | string>,
97
+ default: 0
98
+ },
99
+ /** 通知的边距 */
100
+ padding: {
101
+ type: [Number, String] as PropType<number | string>,
102
+ default: '18rpx 24rpx'
103
+ },
104
+ /** list列表为空时,是否显示组件 */
105
+ noListHidden: {
106
+ type: Boolean,
107
+ default: true
108
+ }
109
+ };
110
+
111
+ export type NoticeBarProps = ExtractPropTypes<typeof NoticeBarProps>;
@@ -47,6 +47,7 @@
47
47
 
48
48
  <script setup lang="ts">
49
49
  import { computed } from 'vue';
50
+ import { NoticeBarProps } from './types';
50
51
 
51
52
  // 组件名称声明
52
53
  defineOptions({ name: 'u-notice-bar' });
@@ -82,108 +83,7 @@ defineOptions({ name: 'u-notice-bar' });
82
83
  * @example <u-notice-bar :more-icon="true" :list="list"></u-notice-bar>
83
84
  */
84
85
 
85
- const props = defineProps({
86
- /** 滚动内容,数组形式 */
87
- list: {
88
- type: Array as () => string[],
89
- default: () => []
90
- },
91
- /** 显示的主题,success|error|primary|info|warning */
92
- type: {
93
- type: String,
94
- default: 'warning'
95
- },
96
- /** 是否显示左侧的音量图标 */
97
- volumeIcon: {
98
- type: Boolean,
99
- default: true
100
- },
101
- /** 音量喇叭的大小 */
102
- volumeSize: {
103
- type: [Number, String],
104
- default: 34
105
- },
106
- /** 是否显示右侧的右箭头图标 */
107
- moreIcon: {
108
- type: Boolean,
109
- default: false
110
- },
111
- /** 是否显示右侧的关闭图标 */
112
- closeIcon: {
113
- type: Boolean,
114
- default: false
115
- },
116
- /** 是否自动播放 */
117
- autoplay: {
118
- type: Boolean,
119
- default: true
120
- },
121
- /** 文字颜色,各图标也会使用文字颜色 */
122
- color: {
123
- type: String,
124
- default: ''
125
- },
126
- /** 背景颜色 */
127
- bgColor: {
128
- type: String,
129
- default: ''
130
- },
131
- /** 滚动方向,horizontal-水平滚动,vertical-垂直滚动 */
132
- mode: {
133
- type: String,
134
- default: 'horizontal'
135
- },
136
- /** 是否显示 */
137
- show: {
138
- type: Boolean,
139
- default: true
140
- },
141
- /** 字体大小,单位rpx */
142
- fontSize: {
143
- type: [Number, String],
144
- default: 28
145
- },
146
- /** 滚动一个周期的时间长,单位ms */
147
- duration: {
148
- type: [Number, String],
149
- default: 2000
150
- },
151
- /** 水平滚动时的滚动速度,即每秒滚动多少rpx */
152
- speed: {
153
- type: [Number, String],
154
- default: 160
155
- },
156
- /** 水平滚动时,是否采用衔接形式滚动 */
157
- isCircular: {
158
- type: Boolean,
159
- default: true
160
- },
161
- /** 播放状态,play-播放,paused-暂停 */
162
- playState: {
163
- type: String,
164
- default: 'play'
165
- },
166
- /** 是否禁止用手滑动切换 */
167
- disableTouch: {
168
- type: Boolean,
169
- default: true
170
- },
171
- /** 滚动通知设置圆角 */
172
- borderRadius: {
173
- type: [Number, String],
174
- default: 0
175
- },
176
- /** 通知的边距 */
177
- padding: {
178
- type: [Number, String],
179
- default: '18rpx 24rpx'
180
- },
181
- /** list列表为空时,是否显示组件 */
182
- noListHidden: {
183
- type: Boolean,
184
- default: true
185
- }
186
- });
86
+ const props = defineProps(NoticeBarProps);
187
87
 
188
88
  const emit = defineEmits<{ (e: 'click', index: number): void; (e: 'close'): void; (e: 'getMore'): void; (e: 'end'): void }>();
189
89
 
@@ -0,0 +1,42 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * NumberBoxProps 步进器 props 类型定义
5
+ * @description 商城购物选择物品数量,支持正整数、禁用、长按等
6
+ */
7
+ export const NumberBoxProps = {
8
+ /** 输入框初始值(默认1) */
9
+ modelValue: { type: Number, default: 1 },
10
+ /** 输入框和按钮的背景颜色(默认#F2F3F5) */
11
+ bgColor: { type: String, default: '#F2F3F5' },
12
+ /** 用户可输入的最小值(默认0) */
13
+ min: { type: Number, default: 0 },
14
+ /** 用户可输入的最大值(默认99999) */
15
+ max: { type: Number, default: 99999 },
16
+ /** 步长,每次加或减的值(默认1) */
17
+ step: { type: Number, default: 1 },
18
+ /** 是否禁用操作,禁用后无法加减或手动修改输入框的值(默认false) */
19
+ disabled: { type: Boolean, default: false },
20
+ /** 输入框文字和按钮字体大小,单位rpx(默认26) */
21
+ size: { type: [Number, String] as PropType<number | string>, default: 26 },
22
+ /** 输入框文字和加减按钮图标的颜色(默认#323233) */
23
+ color: { type: String, default: '#323233' },
24
+ /** 输入框宽度,单位rpx(默认80) */
25
+ inputWidth: { type: [Number, String] as PropType<number | string>, default: 80 },
26
+ /** 输入框和按钮的高度,单位rpx(默认50) */
27
+ inputHeight: { type: [Number, String] as PropType<number | string>, default: 50 },
28
+ /** 事件回调时用以区分当前发生变化的是哪个输入框 */
29
+ index: { type: [Number, String] as PropType<number | string>, default: '' },
30
+ /** 是否禁止输入框手动输入值(默认false) */
31
+ disabledInput: { type: Boolean, default: false },
32
+ /** 指定光标于键盘的距离,避免键盘遮挡输入框,单位rpx(默认100) */
33
+ cursorSpacing: { type: [Number, String] as PropType<number | string>, default: 100 },
34
+ /** 是否开启长按连续递增或递减(默认true) */
35
+ longPress: { type: Boolean, default: true },
36
+ /** 开启长按触发后,每触发一次需要多久,单位ms(默认250) */
37
+ pressTime: { type: [Number, String] as PropType<number | string>, default: 250 },
38
+ /** 是否只能输入大于或等于0的整数(正整数)(默认true) */
39
+ positiveInteger: { type: Boolean, default: true }
40
+ };
41
+
42
+ export type NumberBoxProps = ExtractPropTypes<typeof NumberBoxProps>;
@@ -48,6 +48,7 @@
48
48
 
49
49
  <script setup lang="ts">
50
50
  import { ref, watch, computed, nextTick } from 'vue';
51
+ import { NumberBoxProps } from './types';
51
52
 
52
53
  defineOptions({
53
54
  name: 'u-number-box'
@@ -79,40 +80,7 @@ defineOptions({
79
80
  * @event {Function} plus 点击增加按钮时触发(按钮可点击情况下),对象形式
80
81
  * @example <u-number-box :min="1" :max="100"></u-number-box>
81
82
  */
82
- const props = defineProps({
83
- /** 输入框初始值(默认1) */
84
- modelValue: { type: Number, default: 1 },
85
- /** 输入框和按钮的背景颜色(默认#F2F3F5) */
86
- bgColor: { type: String, default: '#F2F3F5' },
87
- /** 用户可输入的最小值(默认0) */
88
- min: { type: Number, default: 0 },
89
- /** 用户可输入的最大值(默认99999) */
90
- max: { type: Number, default: 99999 },
91
- /** 步长,每次加或减的值(默认1) */
92
- step: { type: Number, default: 1 },
93
- /** 是否禁用操作,禁用后无法加减或手动修改输入框的值(默认false) */
94
- disabled: { type: Boolean, default: false },
95
- /** 输入框文字和按钮字体大小,单位rpx(默认26) */
96
- size: { type: [Number, String], default: 26 },
97
- /** 输入框文字和加减按钮图标的颜色(默认#323233) */
98
- color: { type: String, default: '#323233' },
99
- /** 输入框宽度,单位rpx(默认80) */
100
- inputWidth: { type: [Number, String], default: 80 },
101
- /** 输入框和按钮的高度,单位rpx(默认50) */
102
- inputHeight: { type: [Number, String], default: 50 },
103
- /** 事件回调时用以区分当前发生变化的是哪个输入框 */
104
- index: { type: [Number, String], default: '' },
105
- /** 是否禁止输入框手动输入值(默认false) */
106
- disabledInput: { type: Boolean, default: false },
107
- /** 指定光标于键盘的距离,避免键盘遮挡输入框,单位rpx(默认100) */
108
- cursorSpacing: { type: [Number, String], default: 100 },
109
- /** 是否开启长按连续递增或递减(默认true) */
110
- longPress: { type: Boolean, default: true },
111
- /** 开启长按触发后,每触发一次需要多久,单位ms(默认250) */
112
- pressTime: { type: [Number, String], default: 250 },
113
- /** 是否只能输入大于或等于0的整数(正整数)(默认true) */
114
- positiveInteger: { type: Boolean, default: true }
115
- });
83
+ const props = defineProps(NumberBoxProps);
116
84
  const emit = defineEmits(['update:modelValue', 'change', 'blur', 'focus', 'minus', 'plus']);
117
85
 
118
86
  // 响应式变量