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.
- package/changelog.md +5 -0
- package/components/u-action-sheet/types.ts +35 -0
- package/components/u-action-sheet/u-action-sheet.vue +2 -47
- package/components/u-alert-tips/types.ts +39 -0
- package/components/u-alert-tips/u-alert-tips.vue +3 -32
- package/components/u-avatar/types.ts +34 -0
- package/components/u-avatar/u-avatar.vue +3 -30
- package/components/u-avatar-cropper/types.ts +23 -0
- package/components/u-avatar-cropper/u-avatar-cropper.vue +2 -45
- package/components/u-back-top/types.ts +39 -0
- package/components/u-back-top/u-back-top.vue +2 -33
- package/components/u-badge/types.ts +36 -0
- package/components/u-badge/u-badge.vue +2 -26
- package/components/u-button/types.ts +66 -0
- package/components/u-button/u-button.vue +3 -88
- package/components/u-calendar/types.ts +63 -0
- package/components/u-calendar/u-calendar.vue +2 -135
- package/components/u-car-keyboard/types.ts +12 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +2 -4
- package/components/u-card/types.ts +59 -0
- package/components/u-card/u-card.vue +2 -48
- package/components/u-cell-group/types.ts +17 -0
- package/components/u-cell-group/u-cell-group.vue +3 -9
- package/components/u-cell-item/types.ts +54 -0
- package/components/u-cell-item/u-cell-item.vue +2 -45
- package/components/u-checkbox/types.ts +31 -0
- package/components/u-checkbox/u-checkbox.vue +2 -47
- package/components/u-checkbox-group/types.ts +32 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +2 -57
- package/components/u-circle-progress/types.ts +52 -0
- package/components/u-circle-progress/u-circle-progress.vue +2 -23
- package/components/u-city-select/types.ts +20 -0
- package/components/u-city-select/u-city-select.vue +2 -10
- package/components/u-col/types.ts +30 -0
- package/components/u-col/u-col.vue +2 -14
- package/components/u-collapse/types.ts +31 -0
- package/components/u-collapse/u-collapse.vue +2 -16
- package/components/u-collapse-item/types.ts +25 -0
- package/components/u-collapse-item/u-collapse-item.vue +2 -16
- package/components/u-column-notice/types.ts +48 -0
- package/components/u-column-notice/u-column-notice.vue +2 -97
- package/components/u-count-down/types.ts +42 -0
- package/components/u-count-down/u-count-down.vue +2 -82
- package/components/u-count-to/types.ts +32 -0
- package/components/u-count-to/u-count-to.vue +2 -58
- package/components/u-divider/types.ts +31 -0
- package/components/u-divider/u-divider.vue +2 -22
- package/components/u-dropdown/types.ts +32 -0
- package/components/u-dropdown/u-dropdown.vue +2 -24
- package/components/u-dropdown-item/types.ts +27 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +4 -16
- package/components/u-empty/types.ts +36 -0
- package/components/u-empty/u-empty.vue +3 -26
- package/components/u-field/types.ts +69 -0
- package/components/u-field/u-field.vue +2 -117
- package/components/u-form/types.ts +25 -0
- package/components/u-form/u-form.vue +2 -46
- package/components/u-form-item/types.ts +70 -0
- package/components/u-form-item/u-form-item.vue +2 -62
- package/components/u-full-screen/types.ts +14 -0
- package/components/u-full-screen/u-full-screen.vue +2 -0
- package/components/u-gap/types.ts +18 -0
- package/components/u-gap/u-gap.vue +2 -10
- package/components/u-grid/types.ts +19 -0
- package/components/u-grid/u-grid.vue +3 -11
- package/components/u-grid-item/types.ts +16 -0
- package/components/u-grid-item/u-grid-item.vue +2 -8
- package/components/u-icon/types.ts +62 -0
- package/components/u-icon/u-icon.vue +2 -123
- package/components/u-image/types.ts +39 -38
- package/components/u-index-anchor/types.ts +16 -0
- package/components/u-index-anchor/u-index-anchor.vue +2 -17
- package/components/u-index-list/types.ts +43 -0
- package/components/u-index-list/u-index-list.vue +13 -34
- package/components/u-input/types.ts +140 -0
- package/components/u-input/u-input.vue +2 -209
- package/components/u-keyboard/types.ts +40 -0
- package/components/u-keyboard/u-keyboard.vue +2 -32
- package/components/u-lazy-load/types.ts +37 -0
- package/components/u-lazy-load/u-lazy-load.vue +3 -58
- package/components/u-line/types.ts +44 -0
- package/components/u-line/u-line.vue +2 -14
- package/components/u-line-progress/types.ts +58 -0
- package/components/u-line-progress/u-line-progress.vue +2 -21
- package/components/u-link/types.ts +43 -0
- package/components/u-link/u-link.vue +2 -14
- package/components/u-loading/types.ts +35 -0
- package/components/u-loading/u-loading.vue +2 -23
- package/components/u-loadmore/types.ts +79 -0
- package/components/u-loadmore/u-loadmore.vue +2 -67
- package/components/u-mask/types.ts +43 -0
- package/components/u-mask/u-mask.vue +2 -33
- package/components/u-message-input/types.ts +74 -0
- package/components/u-message-input/u-message-input.vue +2 -62
- package/components/u-modal/types.ts +118 -0
- package/components/u-modal/u-modal.vue +2 -86
- package/components/u-navbar/types.ts +103 -0
- package/components/u-navbar/u-navbar.vue +2 -90
- package/components/u-no-network/types.ts +28 -0
- package/components/u-no-network/u-no-network.vue +2 -23
- package/components/u-notice-bar/types.ts +111 -0
- package/components/u-notice-bar/u-notice-bar.vue +2 -102
- package/components/u-number-box/types.ts +42 -0
- package/components/u-number-box/u-number-box.vue +2 -34
- package/components/u-number-keyboard/types.ts +26 -0
- package/components/u-number-keyboard/u-number-keyboard.vue +2 -8
- package/components/u-picker/types.ts +111 -0
- package/components/u-picker/u-picker.vue +3 -174
- package/components/u-popup/types.ts +59 -0
- package/components/u-popup/u-popup.vue +2 -47
- package/components/u-radio/types.ts +25 -0
- package/components/u-radio/u-radio.vue +2 -16
- package/components/u-radio-group/types.ts +29 -0
- package/components/u-radio-group/u-radio-group.vue +2 -20
- package/components/u-rate/types.ts +40 -0
- package/components/u-rate/u-rate.vue +2 -124
- package/components/u-read-more/types.ts +35 -0
- package/components/u-read-more/u-read-more.vue +2 -51
- package/components/u-row/types.ts +20 -0
- package/components/u-row/u-row.vue +2 -10
- package/components/u-row-notice/types.ts +39 -0
- package/components/u-row-notice/u-row-notice.vue +2 -72
- package/components/u-search/types.ts +53 -0
- package/components/u-search/u-search.vue +2 -44
- package/components/u-section/types.ts +32 -0
- package/components/u-section/u-section.vue +2 -52
- package/components/u-select/types.ts +43 -0
- package/components/u-select/u-select.vue +2 -34
- package/components/u-skeleton/types.ts +20 -0
- package/components/u-skeleton/u-skeleton.vue +2 -27
- package/components/u-slider/types.ts +32 -0
- package/components/u-slider/u-slider.vue +2 -57
- package/components/u-steps/types.ts +28 -0
- package/components/u-steps/u-steps.vue +2 -42
- package/components/u-sticky/types.ts +22 -0
- package/components/u-sticky/u-sticky.vue +2 -32
- package/components/u-subsection/types.ts +36 -0
- package/components/u-subsection/u-subsection.vue +2 -62
- package/components/u-swipe-action/types.ts +50 -0
- package/components/u-swipe-action/u-swipe-action.vue +2 -39
- package/components/u-swiper/types.ts +47 -0
- package/components/u-swiper/u-swiper.vue +2 -41
- package/components/u-switch/types.ts +28 -0
- package/components/u-switch/u-switch.vue +2 -20
- package/components/u-tabbar/types.ts +36 -0
- package/components/u-tabbar/u-tabbar.vue +6 -75
- package/components/u-table/types.ts +25 -0
- package/components/u-table/u-table.vue +2 -51
- package/components/u-tabs/types.ts +51 -0
- package/components/u-tabs/u-tabs.vue +6 -44
- package/components/u-tabs-swiper/types.ts +53 -0
- package/components/u-tabs-swiper/u-tabs-swiper.vue +3 -50
- package/components/u-tag/types.ts +37 -0
- package/components/u-tag/u-tag.vue +2 -28
- package/components/u-td/types.ts +12 -0
- package/components/u-td/u-td.vue +2 -9
- package/components/u-th/types.ts +12 -0
- package/components/u-th/u-th.vue +2 -9
- package/components/u-time-line-item/types.ts +14 -0
- package/components/u-time-line-item/u-time-line-item.vue +2 -12
- package/components/u-toast/types.ts +35 -3
- package/components/u-toast/u-toast.vue +2 -7
- package/components/u-top-tips/types.ts +14 -0
- package/components/u-top-tips/u-top-tips.vue +17 -22
- package/components/u-tr/types.ts +8 -0
- package/components/u-tr/u-tr.vue +3 -0
- package/components/u-upload/types.ts +71 -0
- package/components/u-upload/u-upload.vue +6 -67
- package/components/u-verification-code/types.ts +22 -0
- package/components/u-verification-code/u-verification-code.vue +2 -32
- package/components/u-waterfall/types.ts +16 -0
- package/components/u-waterfall/u-waterfall.vue +2 -18
- package/package.json +1 -1
- package/types/global.d.ts +200 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* u-count-down 倒计时 Props
|
|
5
|
+
* @description 该组件一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
|
|
6
|
+
*/
|
|
7
|
+
export const CountDownProps = {
|
|
8
|
+
/** 倒计时的时间,秒为单位 */
|
|
9
|
+
timestamp: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
10
|
+
/** 是否自动开始倒计时 */
|
|
11
|
+
autoplay: { type: Boolean, default: true },
|
|
12
|
+
/** 分隔符 */
|
|
13
|
+
separator: { type: String, default: 'colon' },
|
|
14
|
+
/** 分隔符的大小,单位rpx */
|
|
15
|
+
separatorSize: { type: [Number, String] as PropType<number | string>, default: 30 },
|
|
16
|
+
/** 分隔符颜色 */
|
|
17
|
+
separatorColor: { type: String, default: '#303133' },
|
|
18
|
+
/** 字体颜色 */
|
|
19
|
+
color: { type: String, default: '#303133' },
|
|
20
|
+
/** 字体大小,单位rpx */
|
|
21
|
+
fontSize: { type: [Number, String] as PropType<number | string>, default: 30 },
|
|
22
|
+
/** 背景颜色 */
|
|
23
|
+
bgColor: { type: String, default: '#fff' },
|
|
24
|
+
/** 数字框高度,单位rpx */
|
|
25
|
+
height: { type: [Number, String] as PropType<number | string>, default: 'auto' },
|
|
26
|
+
/** 是否显示数字框 */
|
|
27
|
+
showBorder: { type: Boolean, default: false },
|
|
28
|
+
/** 边框颜色 */
|
|
29
|
+
borderColor: { type: String, default: '#303133' },
|
|
30
|
+
/** 是否显示秒 */
|
|
31
|
+
showSeconds: { type: Boolean, default: true },
|
|
32
|
+
/** 是否显示分钟 */
|
|
33
|
+
showMinutes: { type: Boolean, default: true },
|
|
34
|
+
/** 是否显示小时 */
|
|
35
|
+
showHours: { type: Boolean, default: true },
|
|
36
|
+
/** 是否显示“天” */
|
|
37
|
+
showDays: { type: Boolean, default: true },
|
|
38
|
+
/** 当"天"的部分为0时,不显示 */
|
|
39
|
+
hideZeroDay: { type: Boolean, default: false }
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type CountDownProps = ExtractPropTypes<typeof CountDownProps>;
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
|
|
54
54
|
<script setup lang="ts">
|
|
55
55
|
import { ref, computed, watch, onMounted } from 'vue';
|
|
56
|
+
import { CountDownProps } from './types';
|
|
56
57
|
|
|
57
58
|
defineOptions({ name: 'u-count-down' });
|
|
58
59
|
|
|
@@ -83,88 +84,7 @@ defineOptions({ name: 'u-count-down' });
|
|
|
83
84
|
|
|
84
85
|
const emit = defineEmits(['end', 'change']);
|
|
85
86
|
|
|
86
|
-
const props = defineProps(
|
|
87
|
-
/** 倒计时的时间,秒为单位 */
|
|
88
|
-
timestamp: {
|
|
89
|
-
type: [Number, String],
|
|
90
|
-
default: 0
|
|
91
|
-
},
|
|
92
|
-
/** 是否自动开始倒计时 */
|
|
93
|
-
autoplay: {
|
|
94
|
-
type: Boolean,
|
|
95
|
-
default: true
|
|
96
|
-
},
|
|
97
|
-
/** 分隔符 */
|
|
98
|
-
separator: {
|
|
99
|
-
type: String,
|
|
100
|
-
default: 'colon'
|
|
101
|
-
},
|
|
102
|
-
/** 分隔符的大小,单位rpx */
|
|
103
|
-
separatorSize: {
|
|
104
|
-
type: [Number, String],
|
|
105
|
-
default: 30
|
|
106
|
-
},
|
|
107
|
-
/** 分隔符颜色 */
|
|
108
|
-
separatorColor: {
|
|
109
|
-
type: String,
|
|
110
|
-
default: '#303133'
|
|
111
|
-
},
|
|
112
|
-
/** 字体颜色 */
|
|
113
|
-
color: {
|
|
114
|
-
type: String,
|
|
115
|
-
default: '#303133'
|
|
116
|
-
},
|
|
117
|
-
/** 字体大小,单位rpx */
|
|
118
|
-
fontSize: {
|
|
119
|
-
type: [Number, String],
|
|
120
|
-
default: 30
|
|
121
|
-
},
|
|
122
|
-
/** 背景颜色 */
|
|
123
|
-
bgColor: {
|
|
124
|
-
type: String,
|
|
125
|
-
default: '#fff'
|
|
126
|
-
},
|
|
127
|
-
/** 数字框高度,单位rpx */
|
|
128
|
-
height: {
|
|
129
|
-
type: [Number, String],
|
|
130
|
-
default: 'auto'
|
|
131
|
-
},
|
|
132
|
-
/** 是否显示数字框 */
|
|
133
|
-
showBorder: {
|
|
134
|
-
type: Boolean,
|
|
135
|
-
default: false
|
|
136
|
-
},
|
|
137
|
-
/** 边框颜色 */
|
|
138
|
-
borderColor: {
|
|
139
|
-
type: String,
|
|
140
|
-
default: '#303133'
|
|
141
|
-
},
|
|
142
|
-
/** 是否显示秒 */
|
|
143
|
-
showSeconds: {
|
|
144
|
-
type: Boolean,
|
|
145
|
-
default: true
|
|
146
|
-
},
|
|
147
|
-
/** 是否显示分钟 */
|
|
148
|
-
showMinutes: {
|
|
149
|
-
type: Boolean,
|
|
150
|
-
default: true
|
|
151
|
-
},
|
|
152
|
-
/** 是否显示小时 */
|
|
153
|
-
showHours: {
|
|
154
|
-
type: Boolean,
|
|
155
|
-
default: true
|
|
156
|
-
},
|
|
157
|
-
/** 是否显示“天” */
|
|
158
|
-
showDays: {
|
|
159
|
-
type: Boolean,
|
|
160
|
-
default: true
|
|
161
|
-
},
|
|
162
|
-
/** 当"天"的部分为0时,不显示 */
|
|
163
|
-
hideZeroDay: {
|
|
164
|
-
type: Boolean,
|
|
165
|
-
default: false
|
|
166
|
-
}
|
|
167
|
-
});
|
|
87
|
+
const props = defineProps(CountDownProps);
|
|
168
88
|
|
|
169
89
|
const d = ref('00'); // 天
|
|
170
90
|
const h = ref('00'); // 小时
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* u-count-to 数字滚动 Props
|
|
5
|
+
* @description 该组件一般用于需要滚动数字到某一个值的场景,目标要求是一个递增的值。
|
|
6
|
+
*/
|
|
7
|
+
export const CountToProps = {
|
|
8
|
+
/** 开始的数值,默认从0增长到某一个数 */
|
|
9
|
+
startVal: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
10
|
+
/** 要滚动的目标数值,必须 */
|
|
11
|
+
endVal: { type: [Number, String] as PropType<number | string>, default: 0, required: true },
|
|
12
|
+
/** 滚动到目标数值的动画持续时间,单位为毫秒(ms) */
|
|
13
|
+
duration: { type: [Number, String] as PropType<number | string>, default: 2000 },
|
|
14
|
+
/** 设置数值后是否自动开始滚动 */
|
|
15
|
+
autoplay: { type: Boolean, default: true },
|
|
16
|
+
/** 要显示的小数位数 */
|
|
17
|
+
decimals: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
18
|
+
/** 是否在即将到达目标数值的时候,使用缓慢滚动的效果 */
|
|
19
|
+
useEasing: { type: Boolean, default: true },
|
|
20
|
+
/** 十进制分割符号 */
|
|
21
|
+
decimal: { type: [Number, String] as PropType<number | string>, default: '.' },
|
|
22
|
+
/** 字体颜色 */
|
|
23
|
+
color: { type: String, default: '#303133' },
|
|
24
|
+
/** 字体大小 */
|
|
25
|
+
fontSize: { type: [Number, String] as PropType<number | string>, default: 50 },
|
|
26
|
+
/** 是否加粗字体 */
|
|
27
|
+
bold: { type: Boolean, default: false },
|
|
28
|
+
/** 千位分隔符,类似金额的分割(¥23,321.05中的",") */
|
|
29
|
+
separator: { type: String, default: '' }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type CountToProps = ExtractPropTypes<typeof CountToProps>;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
15
|
import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
|
|
16
|
+
import { CountToProps } from './types';
|
|
16
17
|
|
|
17
18
|
defineOptions({ name: 'u-count-to' });
|
|
18
19
|
|
|
@@ -36,64 +37,7 @@ defineOptions({ name: 'u-count-to' });
|
|
|
36
37
|
|
|
37
38
|
const emit = defineEmits(['end']);
|
|
38
39
|
|
|
39
|
-
const props = defineProps(
|
|
40
|
-
/** 开始的数值,默认从0增长到某一个数 */
|
|
41
|
-
startVal: {
|
|
42
|
-
type: [Number, String],
|
|
43
|
-
default: 0
|
|
44
|
-
},
|
|
45
|
-
/** 要滚动的目标数值,必须 */
|
|
46
|
-
endVal: {
|
|
47
|
-
type: [Number, String],
|
|
48
|
-
default: 0,
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
/** 滚动到目标数值的动画持续时间,单位为毫秒(ms) */
|
|
52
|
-
duration: {
|
|
53
|
-
type: [Number, String],
|
|
54
|
-
default: 2000
|
|
55
|
-
},
|
|
56
|
-
/** 设置数值后是否自动开始滚动 */
|
|
57
|
-
autoplay: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: true
|
|
60
|
-
},
|
|
61
|
-
/** 要显示的小数位数 */
|
|
62
|
-
decimals: {
|
|
63
|
-
type: [Number, String],
|
|
64
|
-
default: 0
|
|
65
|
-
},
|
|
66
|
-
/** 是否在即将到达目标数值的时候,使用缓慢滚动的效果 */
|
|
67
|
-
useEasing: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: true
|
|
70
|
-
},
|
|
71
|
-
/** 十进制分割符号 */
|
|
72
|
-
decimal: {
|
|
73
|
-
type: [Number, String],
|
|
74
|
-
default: '.'
|
|
75
|
-
},
|
|
76
|
-
/** 字体颜色 */
|
|
77
|
-
color: {
|
|
78
|
-
type: String,
|
|
79
|
-
default: '#303133'
|
|
80
|
-
},
|
|
81
|
-
/** 字体大小 */
|
|
82
|
-
fontSize: {
|
|
83
|
-
type: [Number, String],
|
|
84
|
-
default: 50
|
|
85
|
-
},
|
|
86
|
-
/** 是否加粗字体 */
|
|
87
|
-
bold: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
default: false
|
|
90
|
-
},
|
|
91
|
-
/** 千位分隔符,类似金额的分割(¥23,321.05中的",") */
|
|
92
|
-
separator: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: ''
|
|
95
|
-
}
|
|
96
|
-
});
|
|
40
|
+
const props = defineProps(CountToProps);
|
|
97
41
|
|
|
98
42
|
const localStartVal = ref(Number(props.startVal));
|
|
99
43
|
const displayValue = ref(formatNumber(props.startVal));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { ThemeType } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* u-divider 分割线 Props
|
|
6
|
+
* @description 区隔内容的分割线,一般用于页面底部"没有更多"的提示。
|
|
7
|
+
*/
|
|
8
|
+
export const DividerProps = {
|
|
9
|
+
/** 单一边divider横线的宽度(数值),单位rpx。或者百分比 */
|
|
10
|
+
halfWidth: { type: [Number, String] as PropType<number | string>, default: 150 },
|
|
11
|
+
/** divider横线的颜色,如设置 */
|
|
12
|
+
borderColor: { type: String, default: '#dcdfe6' },
|
|
13
|
+
/** 主题色,可以是primary|info|success|warning|error之一值 */
|
|
14
|
+
type: { type: String as PropType<ThemeType>, default: 'primary' },
|
|
15
|
+
/** 文字颜色 */
|
|
16
|
+
color: { type: String, default: '#909399' },
|
|
17
|
+
/** 文字大小,单位rpx */
|
|
18
|
+
fontSize: { type: [Number, String] as PropType<number | string>, default: 26 },
|
|
19
|
+
/** 整个divider的背景颜色 */
|
|
20
|
+
bgColor: { type: String, default: '#ffffff' },
|
|
21
|
+
/** 整个divider的高度单位rpx */
|
|
22
|
+
height: { type: [Number, String] as PropType<number | string>, default: 'auto' },
|
|
23
|
+
/** 上边距 */
|
|
24
|
+
marginTop: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
25
|
+
/** 下边距 */
|
|
26
|
+
marginBottom: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
27
|
+
/** 是否使用slot传入内容,如果不用slot传入内容,先的中间就不会有空隙 */
|
|
28
|
+
useSlot: { type: Boolean, default: true }
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type DividerProps = ExtractPropTypes<typeof DividerProps>;
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script setup lang="ts">
|
|
27
27
|
import { computed } from 'vue';
|
|
28
|
+
import { DividerProps } from './types';
|
|
28
29
|
|
|
29
30
|
defineOptions({
|
|
30
31
|
name: 'u-divider'
|
|
@@ -47,28 +48,7 @@ defineOptions({
|
|
|
47
48
|
* @event {Function} click divider组件被点击时触发
|
|
48
49
|
* @example <u-divider color="#fa3534">长河落日圆</u-divider>
|
|
49
50
|
*/
|
|
50
|
-
const props = defineProps(
|
|
51
|
-
/** 单一边divider横线的宽度(数值),单位rpx。或者百分比 */
|
|
52
|
-
halfWidth: { type: [Number, String], default: 150 },
|
|
53
|
-
/** divider横线的颜色,如设置 */
|
|
54
|
-
borderColor: { type: String, default: '#dcdfe6' },
|
|
55
|
-
/** 主题色,可以是primary|info|success|warning|error之一值 */
|
|
56
|
-
type: { type: String, default: 'primary' },
|
|
57
|
-
/** 文字颜色 */
|
|
58
|
-
color: { type: String, default: '#909399' },
|
|
59
|
-
/** 文字大小,单位rpx */
|
|
60
|
-
fontSize: { type: [Number, String], default: 26 },
|
|
61
|
-
/** 整个divider的背景颜色 */
|
|
62
|
-
bgColor: { type: String, default: '#ffffff' },
|
|
63
|
-
/** 整个divider的高度单位rpx */
|
|
64
|
-
height: { type: [Number, String], default: 'auto' },
|
|
65
|
-
/** 上边距 */
|
|
66
|
-
marginTop: { type: [String, Number], default: 0 },
|
|
67
|
-
/** 下边距 */
|
|
68
|
-
marginBottom: { type: [String, Number], default: 0 },
|
|
69
|
-
/** 是否使用slot传入内容,如果不用slot传入内容,先的中间就不会有空隙 */
|
|
70
|
-
useSlot: { type: Boolean, default: true }
|
|
71
|
-
});
|
|
51
|
+
const props = defineProps(DividerProps);
|
|
72
52
|
|
|
73
53
|
const emit = defineEmits(['click']);
|
|
74
54
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* u-dropdown 下拉菜单 Props
|
|
5
|
+
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
6
|
+
*/
|
|
7
|
+
export const DropdownProps = {
|
|
8
|
+
/** 菜单标题和选项的激活态颜色 */
|
|
9
|
+
activeColor: { type: String, default: '#2979ff' },
|
|
10
|
+
/** 菜单标题和选项的未激活态颜色 */
|
|
11
|
+
inactiveColor: { type: String, default: '#606266' },
|
|
12
|
+
/** 点击遮罩是否关闭菜单 */
|
|
13
|
+
closeOnClickMask: { type: Boolean, default: true },
|
|
14
|
+
/** 点击当前激活项标题是否关闭菜单 */
|
|
15
|
+
closeOnClickSelf: { type: Boolean, default: true },
|
|
16
|
+
/** 过渡时间 */
|
|
17
|
+
duration: { type: [Number, String] as PropType<number | string>, default: 300 },
|
|
18
|
+
/** 标题菜单的高度,单位任意,数值默认为rpx单位 */
|
|
19
|
+
height: { type: [Number, String] as PropType<number | string>, default: 80 },
|
|
20
|
+
/** 是否显示下边框 */
|
|
21
|
+
borderBottom: { type: Boolean, default: false },
|
|
22
|
+
/** 标题的字体大小 */
|
|
23
|
+
titleSize: { type: [Number, String] as PropType<number | string>, default: 28 },
|
|
24
|
+
/** 下拉出来的内容部分的圆角值 */
|
|
25
|
+
borderRadius: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
26
|
+
/** 菜单右侧的icon图标 */
|
|
27
|
+
menuIcon: { type: String, default: 'arrow-down' },
|
|
28
|
+
/** 菜单右侧图标的大小 */
|
|
29
|
+
menuIconSize: { type: [Number, String] as PropType<number | string>, default: 26 }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type DropdownProps = ExtractPropTypes<typeof DropdownProps>;
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
<script setup lang="ts">
|
|
52
52
|
import { ref, computed, onMounted, getCurrentInstance } from 'vue';
|
|
53
53
|
import { $u } from '../..';
|
|
54
|
+
import { DropdownProps } from './types';
|
|
54
55
|
|
|
55
56
|
defineOptions({ name: 'u-dropdown' });
|
|
56
57
|
|
|
@@ -72,30 +73,7 @@ defineOptions({ name: 'u-dropdown' });
|
|
|
72
73
|
* @example <u-dropdown></u-dropdown>
|
|
73
74
|
*/
|
|
74
75
|
|
|
75
|
-
const props = defineProps(
|
|
76
|
-
/** 菜单标题和选项的激活态颜色 */
|
|
77
|
-
activeColor: { type: String, default: '#2979ff' },
|
|
78
|
-
/** 菜单标题和选项的未激活态颜色 */
|
|
79
|
-
inactiveColor: { type: String, default: '#606266' },
|
|
80
|
-
/** 点击遮罩是否关闭菜单 */
|
|
81
|
-
closeOnClickMask: { type: Boolean, default: true },
|
|
82
|
-
/** 点击当前激活项标题是否关闭菜单 */
|
|
83
|
-
closeOnClickSelf: { type: Boolean, default: true },
|
|
84
|
-
/** 过渡时间 */
|
|
85
|
-
duration: { type: [Number, String], default: 300 },
|
|
86
|
-
/** 标题菜单的高度,单位任意,数值默认为rpx单位 */
|
|
87
|
-
height: { type: [Number, String], default: 80 },
|
|
88
|
-
/** 是否显示下边框 */
|
|
89
|
-
borderBottom: { type: Boolean, default: false },
|
|
90
|
-
/** 标题的字体大小 */
|
|
91
|
-
titleSize: { type: [Number, String], default: 28 },
|
|
92
|
-
/** 下拉出来的内容部分的圆角值 */
|
|
93
|
-
borderRadius: { type: [Number, String], default: 0 },
|
|
94
|
-
/** 菜单右侧的icon图标 */
|
|
95
|
-
menuIcon: { type: String, default: 'arrow-down' },
|
|
96
|
-
/** 菜单右侧图标的大小 */
|
|
97
|
-
menuIconSize: { type: [Number, String], default: 26 }
|
|
98
|
-
});
|
|
76
|
+
const props = defineProps(DropdownProps);
|
|
99
77
|
|
|
100
78
|
// emits 定义
|
|
101
79
|
const emit = defineEmits(['open', 'close']);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { OptionType } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* u-dropdown-item 下拉菜单项 Props
|
|
6
|
+
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
|
7
|
+
* @property {String|Number|Array} modelValue 双向绑定选项卡选择值
|
|
8
|
+
* @property {String|Number} title 菜单项标题
|
|
9
|
+
* @property {OptionType[]} options 选项数据,如果传入了默认slot,此参数无效
|
|
10
|
+
* @property {Boolean} disabled 是否禁用此选项卡(默认false)
|
|
11
|
+
* @property {String|Number} height 弹窗下拉内容的高度(内容超出将会滚动)(默认auto)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const DropdownItemProps = {
|
|
15
|
+
/** 当前选中项的value值 */
|
|
16
|
+
modelValue: { type: [Number, String, Array] as PropType<number | string | any[]>, default: '' },
|
|
17
|
+
/** 菜单项标题 */
|
|
18
|
+
title: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
19
|
+
/** 选项数据,如果传入了默认slot,此参数无效 */
|
|
20
|
+
options: { type: Array as PropType<OptionType[]>, default: () => [] },
|
|
21
|
+
/** 是否禁用此菜单项 */
|
|
22
|
+
disabled: { type: Boolean, default: false },
|
|
23
|
+
/** 下拉弹窗的高度 */
|
|
24
|
+
height: { type: [Number, String] as PropType<number | string>, default: 'auto' }
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type DropdownItemProps = ExtractPropTypes<typeof DropdownItemProps>;
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
<script setup lang="ts">
|
|
26
26
|
import { ref, computed, onMounted, getCurrentInstance, useSlots, watch } from 'vue';
|
|
27
|
-
import { $u } from '../..';
|
|
27
|
+
import { $u } from '../..';
|
|
28
|
+
import { DropdownItemProps } from './types';
|
|
28
29
|
|
|
29
30
|
defineOptions({ name: 'u-dropdown-item' });
|
|
30
31
|
|
|
@@ -41,21 +42,8 @@ defineOptions({ name: 'u-dropdown-item' });
|
|
|
41
42
|
* @example <u-dropdown-item title="标题"></u-dropdown-item>
|
|
42
43
|
*/
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// props 定义,保留参数注释
|
|
47
|
-
const props = defineProps({
|
|
48
|
-
/** 当前选中项的value值 */
|
|
49
|
-
modelValue: { type: [Number, String, Array], default: '' },
|
|
50
|
-
/** 菜单项标题 */
|
|
51
|
-
title: { type: [String, Number], default: '' },
|
|
52
|
-
/** 选项数据,如果传入了默认slot,此参数无效 */
|
|
53
|
-
options: { type: Array as () => OptionType[], default: () => [] },
|
|
54
|
-
/** 是否禁用此菜单项 */
|
|
55
|
-
disabled: { type: Boolean, default: false },
|
|
56
|
-
/** 下拉弹窗的高度 */
|
|
57
|
-
height: { type: [Number, String], default: 'auto' }
|
|
58
|
-
});
|
|
45
|
+
// props 定义
|
|
46
|
+
const props = defineProps(DropdownItemProps);
|
|
59
47
|
|
|
60
48
|
// emits 定义
|
|
61
49
|
const emit = defineEmits(['update:modelValue', 'change']);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* u-empty 组件 Props 类型定义
|
|
5
|
+
*/
|
|
6
|
+
export const EmptyProps = {
|
|
7
|
+
/** 图标路径 */
|
|
8
|
+
src: { type: String, default: '' },
|
|
9
|
+
/** 提示文字 */
|
|
10
|
+
text: { type: String, default: '' },
|
|
11
|
+
/** 文字颜色 */
|
|
12
|
+
color: { type: String, default: '#c0c4cc' },
|
|
13
|
+
/** 图标的颜色 */
|
|
14
|
+
iconColor: { type: String, default: '#c0c4cc' },
|
|
15
|
+
/** 图标的大小 */
|
|
16
|
+
iconSize: { type: [String, Number] as PropType<string | number>, default: 120 },
|
|
17
|
+
/** 文字大小,单位rpx */
|
|
18
|
+
fontSize: { type: [String, Number] as PropType<string | number>, default: 26 },
|
|
19
|
+
/** 选择预置的图标类型 */
|
|
20
|
+
mode: { type: String, default: 'data' },
|
|
21
|
+
/** 图标宽度,单位rpx */
|
|
22
|
+
imgWidth: { type: [String, Number] as PropType<string | number>, default: 120 },
|
|
23
|
+
/** 图标高度,单位rpx */
|
|
24
|
+
imgHeight: { type: [String, Number] as PropType<string | number>, default: 'auto' },
|
|
25
|
+
/** 是否显示组件 */
|
|
26
|
+
show: { type: Boolean, default: true },
|
|
27
|
+
/** 组件距离上一个元素之间的距离 */
|
|
28
|
+
marginTop: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
29
|
+
/** 图标自定义样式 */
|
|
30
|
+
iconStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) }
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* u-empty 组件 Props 类型
|
|
35
|
+
*/
|
|
36
|
+
export type EmptyProps = ExtractPropTypes<typeof EmptyProps>;
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script setup lang="ts">
|
|
21
|
+
import { EmptyProps } from './types';
|
|
22
|
+
|
|
21
23
|
defineOptions({
|
|
22
24
|
name: 'u-empty'
|
|
23
25
|
});
|
|
@@ -39,32 +41,7 @@ defineOptions({
|
|
|
39
41
|
* @event {Function} close 点击关闭按钮时触发
|
|
40
42
|
* @example <u-empty text="所谓伊人,在水一方" mode="list"></u-empty>
|
|
41
43
|
*/
|
|
42
|
-
const props = defineProps(
|
|
43
|
-
/** 图标路径 */
|
|
44
|
-
src: { type: String, default: '' },
|
|
45
|
-
/** 提示文字 */
|
|
46
|
-
text: { type: String, default: '' },
|
|
47
|
-
/** 文字颜色 */
|
|
48
|
-
color: { type: String, default: '#c0c4cc' },
|
|
49
|
-
/** 图标的颜色 */
|
|
50
|
-
iconColor: { type: String, default: '#c0c4cc' },
|
|
51
|
-
/** 图标的大小 */
|
|
52
|
-
iconSize: { type: [String, Number], default: 120 },
|
|
53
|
-
/** 文字大小,单位rpx */
|
|
54
|
-
fontSize: { type: [String, Number], default: 26 },
|
|
55
|
-
/** 选择预置的图标类型 */
|
|
56
|
-
mode: { type: String, default: 'data' },
|
|
57
|
-
/** 图标宽度,单位rpx */
|
|
58
|
-
imgWidth: { type: [String, Number], default: 120 },
|
|
59
|
-
/** 图标高度,单位rpx */
|
|
60
|
-
imgHeight: { type: [String, Number], default: 'auto' },
|
|
61
|
-
/** 是否显示组件 */
|
|
62
|
-
show: { type: Boolean, default: true },
|
|
63
|
-
/** 组件距离上一个元素之间的距离 */
|
|
64
|
-
marginTop: { type: [String, Number], default: 0 },
|
|
65
|
-
/** 图标自定义样式 */
|
|
66
|
-
iconStyle: { type: Object, default: () => ({}) }
|
|
67
|
-
});
|
|
44
|
+
const props = defineProps(EmptyProps);
|
|
68
45
|
|
|
69
46
|
/**
|
|
70
47
|
* 预置图标对应的提示文字
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { InputAlign, InputConfirmType, InputLabelPosition, InputType } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* u-field 组件 Props 类型定义
|
|
6
|
+
* @description 表单输入框属性
|
|
7
|
+
*/
|
|
8
|
+
export const FieldProps = {
|
|
9
|
+
/** label左边的图标,限uView的图标名称 */
|
|
10
|
+
icon: String,
|
|
11
|
+
/** 输入框右边的图标名称,限uView的图标名称(默认false) */
|
|
12
|
+
rightIcon: String,
|
|
13
|
+
/** 方向属性 */
|
|
14
|
+
arrowDirection: { type: String, default: 'right' },
|
|
15
|
+
/** 是否必填,左边显示红色"*"号(默认false) */
|
|
16
|
+
required: Boolean,
|
|
17
|
+
/** 输入框左边的文字提示 */
|
|
18
|
+
label: String,
|
|
19
|
+
/** 是否密码输入方式(用点替换文字),type为text时有效(默认false) */
|
|
20
|
+
password: Boolean,
|
|
21
|
+
/** 是否显示右侧清空内容的图标控件(默认true) */
|
|
22
|
+
clearable: { type: Boolean, default: true },
|
|
23
|
+
/** label的宽度,单位rpx(默认130) */
|
|
24
|
+
labelWidth: { type: [Number, String] as PropType<string | number>, default: 130 },
|
|
25
|
+
/** label的文字对齐方式(默认left) */
|
|
26
|
+
labelAlign: { type: String as PropType<InputAlign>, default: 'left' },
|
|
27
|
+
/** 输入框内容对齐方式(默认left) */
|
|
28
|
+
inputAlign: { type: String as PropType<InputAlign>, default: 'left' },
|
|
29
|
+
/** 左边通过icon配置的图标的颜色(默认#606266) */
|
|
30
|
+
iconColor: { type: String, default: '#606266' },
|
|
31
|
+
/** 是否自动增高输入区域,type为textarea时有效(默认true) */
|
|
32
|
+
autoHeight: { type: Boolean, default: true },
|
|
33
|
+
/** 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息 */
|
|
34
|
+
errorMessage: { type: [String, Boolean] as PropType<string | boolean>, default: '' },
|
|
35
|
+
/** 输入框的提示文字 */
|
|
36
|
+
placeholder: String,
|
|
37
|
+
/** placeholder的样式(内联样式,字符串),如"color: #ddd" */
|
|
38
|
+
placeholderStyle: String,
|
|
39
|
+
/** 是否自动获得焦点(默认false) */
|
|
40
|
+
focus: Boolean,
|
|
41
|
+
/** 如果type为textarea,且在一个"position:fixed"的区域,需要指明为true(默认false) */
|
|
42
|
+
fixed: Boolean,
|
|
43
|
+
/** 输入框绑定值 */
|
|
44
|
+
modelValue: [Number, String],
|
|
45
|
+
/** 输入框类型(text/textarea/password等,默认text) */
|
|
46
|
+
type: { type: String as PropType<InputType>, default: 'text' },
|
|
47
|
+
/** 是否不可输入(默认false) */
|
|
48
|
+
disabled: { type: Boolean, default: false },
|
|
49
|
+
/** 最大输入长度,设置为 -1 的时候不限制最大长度(默认140) */
|
|
50
|
+
maxlength: { type: [Number, String] as PropType<string | number>, default: 140 },
|
|
51
|
+
/** 设置键盘右下角按钮的文字,仅在type="text"时生效(默认done) */
|
|
52
|
+
confirmType: { type: String as PropType<InputConfirmType>, default: 'done' },
|
|
53
|
+
/** label位置(默认left)left-左边,top-上边 */
|
|
54
|
+
labelPosition: { type: String as PropType<InputLabelPosition>, default: 'left' },
|
|
55
|
+
/** 自定义输入框的样式,对象形式 */
|
|
56
|
+
fieldStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
57
|
+
/** 清除图标的大小,单位rpx(默认30) */
|
|
58
|
+
clearSize: { type: [Number, String] as PropType<string | number>, default: 30 },
|
|
59
|
+
/** 左侧图标样式 */
|
|
60
|
+
iconStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
61
|
+
/** 是否显示field的上边框(默认false) */
|
|
62
|
+
borderTop: { type: Boolean, default: false },
|
|
63
|
+
/** 是否显示field的下边框(默认true) */
|
|
64
|
+
borderBottom: { type: Boolean, default: true },
|
|
65
|
+
/** 是否自动去除输入内容首尾空格(默认true) */
|
|
66
|
+
trim: { type: Boolean, default: true }
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type FieldProps = ExtractPropTypes<typeof FieldProps>;
|