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
@@ -18,6 +18,7 @@
18
18
  <script setup lang="ts">
19
19
  import { computed, inject, getCurrentInstance, onMounted } from 'vue';
20
20
  import { $u } from '../..';
21
+ import { CheckboxProps } from './types';
21
22
 
22
23
  defineOptions({
23
24
  name: 'u-checkbox'
@@ -38,53 +39,7 @@ defineOptions({
38
39
  * @example <u-checkbox v-model="checked" :disabled="false">天涯</u-checkbox>
39
40
  */
40
41
 
41
- const props = defineProps({
42
- /** checkbox的名称 */
43
- name: {
44
- type: [String, Number],
45
- default: ''
46
- },
47
- /** 形状,square为方形,circle为原型 */
48
- shape: {
49
- type: String,
50
- default: ''
51
- },
52
- /** 是否为选中状态 */
53
- modelValue: {
54
- type: Boolean,
55
- default: false
56
- },
57
- /** 是否禁用 */
58
- disabled: {
59
- type: [String, Boolean],
60
- default: ''
61
- },
62
- /** 是否禁止点击提示语选中复选框 */
63
- labelDisabled: {
64
- type: [String, Boolean],
65
- default: ''
66
- },
67
- /** 选中状态下的颜色,如设置此值,将会覆盖checkboxGroup的activeColor值 */
68
- activeColor: {
69
- type: String,
70
- default: ''
71
- },
72
- /** 图标的大小,单位rpx */
73
- iconSize: {
74
- type: [String, Number],
75
- default: ''
76
- },
77
- /** label的字体大小,rpx单位 */
78
- labelSize: {
79
- type: [String, Number],
80
- default: ''
81
- },
82
- /** 组件的整体大小 */
83
- size: {
84
- type: [String, Number],
85
- default: ''
86
- }
87
- });
42
+ const props = defineProps(CheckboxProps);
88
43
 
89
44
  const emit = defineEmits(['change', 'update:modelValue']);
90
45
 
@@ -0,0 +1,32 @@
1
+ import { type ExtractPropTypes, type PropType } from 'vue';
2
+ import type { Shape } from '../../types/global';
3
+
4
+ /**
5
+ * checkbox-group 复选框组类型定义
6
+ * @description 供 u-checkbox-group 组件 props 使用
7
+ */
8
+
9
+ export const CheckboxGroupProps = {
10
+ /** 最多能选中多少个checkbox */
11
+ max: { type: [Number, String], default: 999 },
12
+ /** 是否禁用所有复选框 */
13
+ disabled: { type: Boolean, default: false },
14
+ /** 在表单内提交时的标识符 */
15
+ name: { type: [Boolean, String], default: '' },
16
+ /** 是否禁止点击提示语选中复选框 */
17
+ labelDisabled: { type: Boolean, default: false },
18
+ /** 形状,square为方形,circle为原型 */
19
+ shape: { type: String as PropType<Shape>, default: 'square' },
20
+ /** 选中状态下的颜色 */
21
+ activeColor: { type: String, default: '#2979ff' },
22
+ /** 组件的整体大小 */
23
+ size: { type: [String, Number], default: 34 },
24
+ /** 每个checkbox占u-checkbox-group的宽度 */
25
+ width: { type: String, default: 'auto' },
26
+ /** 是否每个checkbox都换行 */
27
+ wrap: { type: Boolean, default: false },
28
+ /** 图标的大小,单位rpx */
29
+ iconSize: { type: [String, Number], default: 20 }
30
+ };
31
+
32
+ export type CheckboxGroupProps = ExtractPropTypes<typeof CheckboxGroupProps>;
@@ -7,6 +7,7 @@
7
7
  <script setup lang="ts">
8
8
  import { ref, getCurrentInstance, provide } from 'vue';
9
9
  import { $u } from '../..';
10
+ import { CheckboxGroupProps } from './types';
10
11
 
11
12
  defineOptions({
12
13
  name: 'u-checkbox-group'
@@ -29,63 +30,7 @@ defineOptions({
29
30
  * @example <u-checkbox-group></u-checkbox-group>
30
31
  */
31
32
 
32
- const props = defineProps({
33
- /** 最多能选中多少个checkbox */
34
- max: {
35
- type: [Number, String],
36
- default: 999
37
- },
38
- // /** 所有选中项的 name */
39
- // value: {
40
- // default: Array,
41
- // default: () => []
42
- // },
43
- /** 是否禁用所有复选框 */
44
- disabled: {
45
- type: Boolean,
46
- default: false
47
- },
48
- /** 在表单内提交时的标识符 */
49
- name: {
50
- type: [Boolean, String],
51
- default: ''
52
- },
53
- /** 是否禁止点击提示语选中复选框 */
54
- labelDisabled: {
55
- type: Boolean,
56
- default: false
57
- },
58
- /** 形状,square为方形,circle为原型 */
59
- shape: {
60
- type: String,
61
- default: 'square'
62
- },
63
- /** 选中状态下的颜色 */
64
- activeColor: {
65
- type: String,
66
- default: '#2979ff'
67
- },
68
- /** 组件的整体大小 */
69
- size: {
70
- type: [String, Number],
71
- default: 34
72
- },
73
- /** 每个checkbox占u-checkbox-group的宽度 */
74
- width: {
75
- type: String,
76
- default: 'auto'
77
- },
78
- /** 是否每个checkbox都换行 */
79
- wrap: {
80
- type: Boolean,
81
- default: false
82
- },
83
- /** 图标的大小,单位rpx */
84
- iconSize: {
85
- type: [String, Number],
86
- default: 20
87
- }
88
- });
33
+ const props = defineProps(CheckboxGroupProps);
89
34
 
90
35
  const emit = defineEmits(['change']);
91
36
 
@@ -0,0 +1,52 @@
1
+ import { type ExtractPropTypes, type PropType } from 'vue';
2
+ import type { ThemeType } from '../../types/global';
3
+
4
+ /**
5
+ * circleProgress 环形进度条 Props
6
+ * @description 展示操作或任务的当前进度,比如上传文件,是一个圆形的进度条。注意:此组件的percent值只能动态增加,不能动态减少。
7
+ */
8
+ export const CircleProgressProps = {
9
+ /** 圆环进度百分比值 */
10
+ percent: {
11
+ type: Number,
12
+ default: 0,
13
+ validator: (val: number) => val >= 0 && val <= 100
14
+ },
15
+ /** 底部圆环的颜色(灰色的圆环) */
16
+ inactiveColor: {
17
+ type: String,
18
+ default: '#ececec'
19
+ },
20
+ /** 圆环激活部分的颜色 */
21
+ activeColor: {
22
+ type: String,
23
+ default: '#19be6b'
24
+ },
25
+ /** 圆环线条的宽度,单位rpx */
26
+ borderWidth: {
27
+ type: [Number, String] as PropType<number | string>,
28
+ default: 14
29
+ },
30
+ /** 整个圆形的宽度,单位rpx */
31
+ width: {
32
+ type: [Number, String] as PropType<number | string>,
33
+ default: 200
34
+ },
35
+ /** 整个圆环执行一圈的时间,单位ms */
36
+ duration: {
37
+ type: [Number, String] as PropType<number | string>,
38
+ default: 1500
39
+ },
40
+ /** 主题类型 */
41
+ type: {
42
+ type: String as PropType<ThemeType>,
43
+ default: ''
44
+ },
45
+ /** 整个圆环进度区域的背景色 */
46
+ bgColor: {
47
+ type: String,
48
+ default: '#ffffff'
49
+ }
50
+ };
51
+
52
+ export type CircleProgressProps = ExtractPropTypes<typeof CircleProgressProps>;
@@ -35,6 +35,7 @@
35
35
  <script setup lang="ts">
36
36
  import { ref, computed, watch, onMounted } from 'vue';
37
37
  import { $u } from '../..';
38
+ import { CircleProgressProps } from './types';
38
39
 
39
40
  defineOptions({
40
41
  name: 'u-circle-progress'
@@ -54,29 +55,7 @@ defineOptions({
54
55
  * @property {String} bg-color 整个组件背景颜色,默认为白色
55
56
  * @example <u-circle-progress active-color="#2979ff" :percent="80"></u-circle-progress>
56
57
  */
57
- const props = defineProps({
58
- /** 圆环进度百分比值 */
59
- percent: {
60
- type: Number,
61
- default: 0,
62
- // 限制值在0到100之间
63
- validator: (val: number) => val >= 0 && val <= 100
64
- },
65
- /** 底部圆环的颜色(灰色的圆环) */
66
- inactiveColor: { type: String, default: '#ececec' },
67
- /** 圆环激活部分的颜色 */
68
- activeColor: { type: String, default: '#19be6b' },
69
- /** 圆环线条的宽度,单位rpx */
70
- borderWidth: { type: [Number, String], default: 14 },
71
- /** 整个圆形的宽度,单位rpx */
72
- width: { type: [Number, String], default: 200 },
73
- /** 整个圆环执行一圈的时间,单位ms */
74
- duration: { type: [Number, String], default: 1500 },
75
- /** 主题类型 */
76
- type: { type: String, default: '' },
77
- /** 整个圆环进度区域的背景色 */
78
- bgColor: { type: String, default: '#ffffff' }
79
- });
58
+ const props = defineProps(CircleProgressProps);
80
59
 
81
60
  let elBgId = $u.guid(); // 非微信端的时候,需用动态的id,否则一个页面多个圆形进度条组件数据会混乱
82
61
  let elId = $u.guid();
@@ -0,0 +1,20 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-city-select 城市选择器 Props
5
+ * @description 用于选择省、市、区三级行政区域,支持回显和自定义初始值。
6
+ */
7
+ export const CitySelectProps = {
8
+ /** 控制弹窗显示与隐藏(v-model) */
9
+ modelValue: { type: Boolean, default: false },
10
+ /** 默认选中的省市区名称数组 */
11
+ defaultRegion: { type: Array as PropType<string[]>, default: () => [] },
12
+ /** 默认选中的省市区编码数组 */
13
+ areaCode: { type: Array as PropType<string[]>, default: () => [] },
14
+ /** 是否允许点击遮罩关闭弹窗 */
15
+ maskCloseAble: { type: Boolean, default: true },
16
+ /** 弹窗层级 */
17
+ zIndex: { type: [String, Number] as PropType<string | number>, default: 0 }
18
+ };
19
+
20
+ export type CitySelectProps = ExtractPropTypes<typeof CitySelectProps>;
@@ -66,7 +66,7 @@ import { ref, computed, onMounted } from 'vue';
66
66
  import provinces from '../../libs/util/province';
67
67
  import citysData from '../../libs/util/city';
68
68
  import areasData from '../../libs/util/area';
69
- import type { PropType } from 'vue';
69
+ import { CitySelectProps } from './types';
70
70
 
71
71
  defineOptions({
72
72
  name: 'u-city-select'
@@ -84,15 +84,7 @@ defineOptions({
84
84
  * @event city-change 选择省市区后触发,返回选中的省市区对象
85
85
  * @example <u-city-select v-model="show" :defaultRegion="['广东省','广州市','天河区']" @city-change="onChange"></u-city-select>
86
86
  */
87
-
88
- // props 定义
89
- const props = defineProps({
90
- modelValue: { type: Boolean, default: false },
91
- defaultRegion: { type: Array as PropType<string[]>, default: () => [] },
92
- areaCode: { type: Array as PropType<string[]>, default: () => [] },
93
- maskCloseAble: { type: Boolean, default: true },
94
- zIndex: { type: [String, Number], default: 0 }
95
- });
87
+ const props = defineProps(CitySelectProps);
96
88
 
97
89
  // emits 定义
98
90
  const emit = defineEmits(['update:modelValue', 'city-change']);
@@ -0,0 +1,30 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { AlignType, JustifyType } from '../../types/global';
3
+
4
+ /**
5
+ * u-col 布局单元格 Props
6
+ * @description 通过基础的 12 分栏,迅速简便地创建布局(搭配<u-row>使用)
7
+ * @property {String|Number} span 栅格占据的列数,总12等分(默认12)
8
+ * @property {String|Number} offset 分栏左边偏移,计算方式与span相同(默认0)
9
+ * @property {JustifyType} justify 水平排列方式,可选值为start、end、center、around、between(默认start)
10
+ * @property {AlignType} align 垂直对齐方式,可选值为top、center、bottom(默认center)
11
+ * @property {String} textAlign 文字对齐方式(默认left)
12
+ * @property {Boolean} stop 是否阻止事件传播(默认true)
13
+ */
14
+
15
+ export const ColProps = {
16
+ /** 占父容器宽度的多少等分,总分为12份 */
17
+ span: { type: [Number, String] as PropType<number | string>, default: 12 },
18
+ /** 指定栅格左侧的间隔数(总12栏) */
19
+ offset: { type: [Number, String] as PropType<number | string>, default: 0 },
20
+ /** 水平排列方式 */
21
+ justify: { type: String as PropType<JustifyType>, default: 'start' },
22
+ /** 垂直对齐方式 */
23
+ align: { type: String as PropType<AlignType>, default: 'center' },
24
+ /** 文字对齐方式 */
25
+ textAlign: { type: String, default: 'left' },
26
+ /** 是否阻止事件传播 */
27
+ stop: { type: Boolean, default: true }
28
+ };
29
+
30
+ export type ColProps = ExtractPropTypes<typeof ColProps>;
@@ -6,6 +6,7 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import { computed, inject } from 'vue';
9
+ import { ColProps } from './types';
9
10
 
10
11
  defineOptions({
11
12
  name: 'u-col'
@@ -23,20 +24,7 @@ defineOptions({
23
24
 
24
25
  const emit = defineEmits<{ (e: 'click'): void }>();
25
26
 
26
- const props = defineProps({
27
- /** 占父容器宽度的多少等分,总分为12份 */
28
- span: { type: [Number, String], default: 12 },
29
- /** 指定栅格左侧的间隔数(总12栏) */
30
- offset: { type: [Number, String], default: 0 },
31
- /** 水平排列方式,可选值为`start`(或`flex-start`)、`end`(或`flex-end`)、`center`、`around`(或`space-around`)、`between`(或`space-between`) */
32
- justify: { type: String, default: 'start' },
33
- /** 垂直对齐方式,可选值为top、center、bottom */
34
- align: { type: String, default: 'center' },
35
- /** 文字对齐方式 */
36
- textAlign: { type: String, default: 'left' },
37
- /** 是否阻止事件传播 */
38
- stop: { type: Boolean, default: true }
39
- });
27
+ const props = defineProps(ColProps);
40
28
 
41
29
  /**
42
30
  * gutter 给col添加间距,左右边距各占一半,从父组件u-row获取
@@ -0,0 +1,31 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+
3
+ /**
4
+ * u-collapse 手风琴 Props
5
+ * @description 通过折叠面板收纳内容区域
6
+ * @property {Boolean} accordion 是否手风琴模式(默认true)
7
+ * @property {Object} headStyle 标题自定义样式,对象形式
8
+ * @property {Object} bodyStyle 主体自定义样式,对象形式
9
+ * @property {Object} itemStyle 每一个item的样式,对象形式
10
+ * @property {Boolean} arrow 是否显示标题右侧的箭头(默认true)
11
+ * @property {String} arrowColor 标题右侧箭头的颜色(默认#909399)
12
+ * @property {String} hoverClass 样式类名,按下时有效(默认u-hover-class)
13
+ */
14
+ export const CollapseProps = {
15
+ /** 是否手风琴模式 */
16
+ accordion: { type: Boolean, default: true },
17
+ /** 头部的样式 */
18
+ headStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
19
+ /** 主体的样式 */
20
+ bodyStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
21
+ /** 每一个item的样式 */
22
+ itemStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
23
+ /** 是否显示右侧的箭头 */
24
+ arrow: { type: Boolean, default: true },
25
+ /** 箭头的颜色 */
26
+ arrowColor: { type: String, default: '#909399' },
27
+ /** 标题部分按压时的样式类,"none"为无效果 */
28
+ hoverClass: { type: String, default: 'u-hover-class' }
29
+ };
30
+
31
+ export type CollapseProps = ExtractPropTypes<typeof CollapseProps>;
@@ -6,6 +6,7 @@
6
6
 
7
7
  <script setup lang="ts">
8
8
  import { ref, provide } from 'vue';
9
+ import { CollapseProps } from './types';
9
10
 
10
11
  defineOptions({
11
12
  name: 'u-collapse'
@@ -24,22 +25,7 @@ defineOptions({
24
25
  * @event {Function} change 当前激活面板展开时触发(如果是手风琴模式,参数activeNames类型为String,否则为Array)
25
26
  * @example <u-collapse></u-collapse>
26
27
  */
27
- const props = defineProps({
28
- /** 是否手风琴模式 */
29
- accordion: { type: Boolean, default: true },
30
- /** 头部的样式 */
31
- headStyle: { type: Object, default: () => ({}) },
32
- /** 主体的样式 */
33
- bodyStyle: { type: Object, default: () => ({}) },
34
- /** 每一个item的样式 */
35
- itemStyle: { type: Object, default: () => ({}) },
36
- /** 是否显示右侧的箭头 */
37
- arrow: { type: Boolean, default: true },
38
- /** 箭头的颜色 */
39
- arrowColor: { type: String, default: '#909399' },
40
- /** 标题部分按压时的样式类,"none"为无效果 */
41
- hoverClass: { type: String, default: 'u-hover-class' }
42
- });
28
+ const props = defineProps(CollapseProps);
43
29
 
44
30
  const emit = defineEmits(['change']);
45
31
 
@@ -0,0 +1,25 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { TextAlign } from '../../types/global';
3
+
4
+ /**
5
+ * u-collapse-item 手风琴Item Props
6
+ * @description 通过折叠面板收纳内容区域(搭配u-collapse使用)
7
+ */
8
+ export const CollapseItemProps = {
9
+ /** 标题 */
10
+ title: { type: String, default: '' },
11
+ /** 标题的对齐方式 */
12
+ align: { type: String as PropType<TextAlign>, default: 'left' },
13
+ /** 是否可以点击收起 */
14
+ disabled: { type: Boolean, default: false },
15
+ /** collapse显示与否 */
16
+ open: { type: Boolean, default: false },
17
+ /** 唯一标识符 */
18
+ name: { type: [Number, String] as PropType<number | string>, default: '' },
19
+ /** 活动样式 */
20
+ activeStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
21
+ /** 标识当前为第几个 */
22
+ index: { type: [String, Number] as PropType<string | number>, default: '' }
23
+ };
24
+
25
+ export type CollapseItemProps = ExtractPropTypes<typeof CollapseItemProps>;
@@ -23,6 +23,7 @@
23
23
  <script setup lang="ts">
24
24
  import { ref, watch, onMounted, useSlots, getCurrentInstance, nextTick, inject } from 'vue';
25
25
  import { $u } from '../..';
26
+ import { CollapseItemProps } from './types';
26
27
 
27
28
  defineOptions({
28
29
  name: 'u-collapse-item'
@@ -42,22 +43,7 @@ defineOptions({
42
43
  * @event {Function} change 某个item被打开或者收起时触发
43
44
  * @example <u-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">{{item.body}}</u-collapse-item>
44
45
  */
45
- const props = defineProps({
46
- /** 标题 */
47
- title: { type: String, default: '' },
48
- /** 标题的对齐方式 */
49
- align: { type: String, default: 'left' },
50
- /** 是否可以点击收起 */
51
- disabled: { type: Boolean, default: false },
52
- /** collapse显示与否 */
53
- open: { type: Boolean, default: false },
54
- /** 唯一标识符 */
55
- name: { type: [Number, String], default: '' },
56
- /** 活动样式 */
57
- activeStyle: { type: Object, default: () => ({}) },
58
- /** 标识当前为第几个 */
59
- index: { type: [String, Number], default: '' }
60
- });
46
+ const props = defineProps(CollapseItemProps);
61
47
 
62
48
  const emit = defineEmits(['change']);
63
49
  const slots = useSlots();
@@ -0,0 +1,48 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { Direction, PlayState, ScrollDirection, ThemeType } from '../../types/global';
3
+
4
+ /**
5
+ * u-column-notice 通告栏 Props
6
+ */
7
+ export const ColumnNoticeProps = {
8
+ /** 显示的内容,数组 */
9
+ list: { type: Array as PropType<string[]>, default: () => [] },
10
+ /** 显示的主题,success|error|primary|info|warning */
11
+ type: { type: String as PropType<ThemeType | 'none'>, default: 'warning' },
12
+ /** 是否显示左侧的音量图标 */
13
+ volumeIcon: { type: Boolean, default: true },
14
+ /** 是否显示右侧的右箭头图标 */
15
+ moreIcon: { type: Boolean, default: false },
16
+ /** 是否显示右侧的关闭图标 */
17
+ closeIcon: { type: Boolean, default: false },
18
+ /** 是否自动播放 */
19
+ autoplay: { type: Boolean, default: true },
20
+ /** 文字颜色,各图标也会使用文字颜色 */
21
+ color: { type: String, default: '' },
22
+ /** 背景颜色 */
23
+ bgColor: { type: String, default: '' },
24
+ /** 滚动方向,row-水平滚动,column-垂直滚动 */
25
+ direction: { type: String as PropType<ScrollDirection>, default: 'row' },
26
+ /** 是否显示 */
27
+ show: { type: Boolean, default: true },
28
+ /** 字体大小,单位rpx */
29
+ fontSize: { type: [Number, String] as PropType<number | string>, default: 26 },
30
+ /** 滚动一个周期的时间长,单位ms */
31
+ duration: { type: [Number, String] as PropType<number | string>, default: 2000 },
32
+ /** 音量喇叭的大小 */
33
+ volumeSize: { type: [Number, String] as PropType<number | string>, default: 34 },
34
+ /** 水平滚动时的滚动速度,即每秒滚动多少rpx,这有利于控制文字无论多少时,都能有一个恒定的速度 */
35
+ speed: { type: Number, default: 160 },
36
+ /** 水平滚动时,是否采用衔接形式滚动 */
37
+ isCircular: { type: Boolean, default: true },
38
+ /** 滚动方向,horizontal-水平滚动,vertical-垂直滚动 */
39
+ mode: { type: String as PropType<Direction>, default: 'horizontal' },
40
+ /** 播放状态,play-播放,paused-暂停 */
41
+ playState: { type: String as PropType<PlayState>, default: 'play' },
42
+ /** 是否禁止用手滑动切换 */
43
+ disableTouch: { type: Boolean, default: true },
44
+ /** 通知的边距 */
45
+ padding: { type: [Number, String] as PropType<number | string>, default: '18rpx 24rpx' }
46
+ };
47
+
48
+ export type ColumnNoticeProps = ExtractPropTypes<typeof ColumnNoticeProps>;
@@ -27,6 +27,7 @@
27
27
 
28
28
  <script setup lang="ts">
29
29
  import { computed } from 'vue';
30
+ import { ColumnNoticeProps } from './types';
30
31
 
31
32
  defineOptions({ name: 'u-column-notice' });
32
33
 
@@ -53,103 +54,7 @@ defineOptions({ name: 'u-column-notice' });
53
54
  * @property {String|Number} padding 通知的边距
54
55
  */
55
56
 
56
- const props = defineProps({
57
- /** 显示的内容,数组 */
58
- list: {
59
- type: Array as () => string[],
60
- default: () => []
61
- },
62
- /** 显示的主题,success|error|primary|info|warning */
63
- type: {
64
- type: String,
65
- default: 'warning'
66
- },
67
- /** 是否显示左侧的音量图标 */
68
- volumeIcon: {
69
- type: Boolean,
70
- default: true
71
- },
72
- /** 是否显示右侧的右箭头图标 */
73
- moreIcon: {
74
- type: Boolean,
75
- default: false
76
- },
77
- /** 是否显示右侧的关闭图标 */
78
- closeIcon: {
79
- type: Boolean,
80
- default: false
81
- },
82
- /** 是否自动播放 */
83
- autoplay: {
84
- type: Boolean,
85
- default: true
86
- },
87
- /** 文字颜色,各图标也会使用文字颜色 */
88
- color: {
89
- type: String,
90
- default: ''
91
- },
92
- /** 背景颜色 */
93
- bgColor: {
94
- type: String,
95
- default: ''
96
- },
97
- /** 滚动方向,row-水平滚动,column-垂直滚动 */
98
- direction: {
99
- type: String,
100
- default: 'row'
101
- },
102
- /** 是否显示 */
103
- show: {
104
- type: Boolean,
105
- default: true
106
- },
107
- /** 字体大小,单位rpx */
108
- fontSize: {
109
- type: [Number, String],
110
- default: 26
111
- },
112
- /** 滚动一个周期的时间长,单位ms */
113
- duration: {
114
- type: [Number, String],
115
- default: 2000
116
- },
117
- /** 音量喇叭的大小 */
118
- volumeSize: {
119
- type: [Number, String],
120
- default: 34
121
- },
122
- /** 水平滚动时的滚动速度,即每秒滚动多少rpx,这有利于控制文字无论多少时,都能有一个恒定的速度 */
123
- speed: {
124
- type: Number,
125
- default: 160
126
- },
127
- /** 水平滚动时,是否采用衔接形式滚动 */
128
- isCircular: {
129
- type: Boolean,
130
- default: true
131
- },
132
- /** 滚动方向,horizontal-水平滚动,vertical-垂直滚动 */
133
- mode: {
134
- type: String,
135
- default: 'horizontal'
136
- },
137
- /** 播放状态,play-播放,paused-暂停 */
138
- playState: {
139
- type: String,
140
- default: 'play'
141
- },
142
- /** 是否禁止用手滑动切换 */
143
- disableTouch: {
144
- type: Boolean,
145
- default: true
146
- },
147
- /** 通知的边距 */
148
- padding: {
149
- type: [Number, String],
150
- default: '18rpx 24rpx'
151
- }
152
- });
57
+ const props = defineProps(ColumnNoticeProps);
153
58
 
154
59
  const emit = defineEmits<{ (e: 'click', index: number): void; (e: 'close'): void; (e: 'getMore'): void; (e: 'end'): void }>();
155
60