uview-pro 0.0.6 → 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 +6 -1
- 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/components.d.ts +0 -91
- package/types/global.d.ts +200 -0
- package/types/index.d.ts +6 -43
- package/types/uni-app.d.ts +2 -0
package/changelog.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
## 0.0.
|
|
1
|
+
## 0.0.8(2025-08-25)
|
|
2
|
+
### ♻️ Code Refactoring | 代码重构
|
|
3
|
+
|
|
4
|
+
- 重构组件 Props 属性定义,每个组件具有完善的 ts 类型定义 ([8cc0de7](https://gitee.com/anyup/uView-Pro/commit/8cc0de7c1527b48dd223d89207135eea01766294))
|
|
5
|
+
- 重构类型定义并统一到全局类型文件 global types ([b0fd010](https://gitee.com/anyup/uView-Pro/commit/b0fd0107289eb1c6df2f58d91b63d9b25902caee))
|
|
6
|
+
## 0.0.7(2025-08-21)
|
|
2
7
|
|
|
3
8
|
### 🐛 Bug Fixes | Bug 修复
|
|
4
9
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
|
+
import type { ActionSheetItem, ActionSheetTips } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* actionSheet 操作菜单
|
|
6
|
+
* @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。
|
|
7
|
+
*/
|
|
8
|
+
export const ActionSheetProps = {
|
|
9
|
+
/** 点击遮罩是否可以关闭actionsheet */
|
|
10
|
+
maskCloseAble: { type: Boolean, default: true },
|
|
11
|
+
/** 按钮的文字数组,可以自定义颜色和字体大小,字体单位为rpx */
|
|
12
|
+
list: {
|
|
13
|
+
type: Array as unknown as PropType<ActionSheetItem[]>,
|
|
14
|
+
default: () => []
|
|
15
|
+
},
|
|
16
|
+
/** 顶部的提示文字 */
|
|
17
|
+
tips: {
|
|
18
|
+
type: Object as unknown as PropType<ActionSheetTips>,
|
|
19
|
+
default: () => ({ text: '', color: '', fontSize: '26' })
|
|
20
|
+
},
|
|
21
|
+
/** 底部的取消按钮 */
|
|
22
|
+
cancelBtn: { type: Boolean, default: true },
|
|
23
|
+
/** 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距 */
|
|
24
|
+
safeAreaInsetBottom: { type: Boolean, default: false },
|
|
25
|
+
/** 通过双向绑定控制组件的弹出与收起 */
|
|
26
|
+
modelValue: { type: Boolean, default: false },
|
|
27
|
+
/** 弹出的顶部圆角值 */
|
|
28
|
+
borderRadius: { type: [String, Number], default: 0 },
|
|
29
|
+
/** 弹出的z-index值 */
|
|
30
|
+
zIndex: { type: [String, Number], default: 0 },
|
|
31
|
+
/** 取消按钮的文字提示 */
|
|
32
|
+
cancelText: { type: String, default: '取消' }
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type ActionSheetProps = ExtractPropTypes<typeof ActionSheetProps>;
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
<script setup lang="ts">
|
|
37
37
|
import { computed } from 'vue';
|
|
38
38
|
import { $u } from '../..';
|
|
39
|
+
import { ActionSheetProps } from './types';
|
|
39
40
|
|
|
40
41
|
defineOptions({
|
|
41
42
|
name: 'u-action-sheet'
|
|
@@ -59,53 +60,7 @@ defineOptions({
|
|
|
59
60
|
* @example <u-action-sheet :list="list" @click="click" v-model="show"></u-action-sheet>
|
|
60
61
|
*/
|
|
61
62
|
|
|
62
|
-
const props = defineProps(
|
|
63
|
-
/** 点击遮罩是否可以关闭actionsheet */
|
|
64
|
-
maskCloseAble: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: true
|
|
67
|
-
},
|
|
68
|
-
/** 按钮的文字数组,可以自定义颜色和字体大小,字体单位为rpx */
|
|
69
|
-
list: {
|
|
70
|
-
type: Array as () => Array<{ text: string; subText?: string; color?: string; fontSize?: string; disabled?: boolean }>,
|
|
71
|
-
default: () => []
|
|
72
|
-
},
|
|
73
|
-
/** 顶部的提示文字 */
|
|
74
|
-
tips: {
|
|
75
|
-
type: Object as () => { text: string; color?: string; fontSize?: string },
|
|
76
|
-
default: () => ({ text: '', color: '', fontSize: '26' })
|
|
77
|
-
},
|
|
78
|
-
/** 底部的取消按钮 */
|
|
79
|
-
cancelBtn: {
|
|
80
|
-
type: Boolean,
|
|
81
|
-
default: true
|
|
82
|
-
},
|
|
83
|
-
/** 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距 */
|
|
84
|
-
safeAreaInsetBottom: {
|
|
85
|
-
type: Boolean,
|
|
86
|
-
default: false
|
|
87
|
-
},
|
|
88
|
-
/** 通过双向绑定控制组件的弹出与收起 */
|
|
89
|
-
modelValue: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
default: false
|
|
92
|
-
},
|
|
93
|
-
/** 弹出的顶部圆角值 */
|
|
94
|
-
borderRadius: {
|
|
95
|
-
type: [String, Number],
|
|
96
|
-
default: 0
|
|
97
|
-
},
|
|
98
|
-
/** 弹出的z-index值 */
|
|
99
|
-
zIndex: {
|
|
100
|
-
type: [String, Number],
|
|
101
|
-
default: 0
|
|
102
|
-
},
|
|
103
|
-
/** 取消按钮的文字提示 */
|
|
104
|
-
cancelText: {
|
|
105
|
-
type: String,
|
|
106
|
-
default: '取消'
|
|
107
|
-
}
|
|
108
|
-
});
|
|
63
|
+
const props = defineProps(ActionSheetProps);
|
|
109
64
|
|
|
110
65
|
const emit = defineEmits(['update:modelValue', 'click', 'close']);
|
|
111
66
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
|
+
import type { ThemeType } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* alertTips 警告提示
|
|
6
|
+
* @description 警告提示,展现需要关注的信息
|
|
7
|
+
*/
|
|
8
|
+
export const AlertTipsProps = {
|
|
9
|
+
/** 显示文字 */
|
|
10
|
+
title: { type: String, default: '' },
|
|
11
|
+
/** 主题,success/warning/info/error */
|
|
12
|
+
type: { type: String as PropType<ThemeType>, default: 'warning' },
|
|
13
|
+
/** 辅助性文字 */
|
|
14
|
+
description: { type: String, default: '' },
|
|
15
|
+
/** 是否可关闭 */
|
|
16
|
+
closeAble: { type: Boolean, default: false },
|
|
17
|
+
/** 关闭按钮自定义文本 */
|
|
18
|
+
closeText: { type: String, default: '' },
|
|
19
|
+
/** 是否显示图标 */
|
|
20
|
+
showIcon: { type: Boolean, default: false },
|
|
21
|
+
/** 文字颜色,如果定义了color值,icon会失效 */
|
|
22
|
+
color: { type: String, default: '' },
|
|
23
|
+
/** 背景颜色 */
|
|
24
|
+
bgColor: { type: String, default: '' },
|
|
25
|
+
/** 边框颜色 */
|
|
26
|
+
borderColor: { type: String, default: '' },
|
|
27
|
+
/** 是否显示 */
|
|
28
|
+
show: { type: Boolean, default: true },
|
|
29
|
+
/** 左边显示的icon */
|
|
30
|
+
icon: { type: String, default: '' },
|
|
31
|
+
/** icon的样式 */
|
|
32
|
+
iconStyle: { type: Object, default: () => ({}) },
|
|
33
|
+
/** 标题的样式 */
|
|
34
|
+
titleStyle: { type: Object, default: () => ({}) },
|
|
35
|
+
/** 描述文字的样式 */
|
|
36
|
+
descStyle: { type: Object, default: () => ({}) }
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type AlertTipsProps = ExtractPropTypes<typeof AlertTipsProps>;
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
import uIcon from '../u-icon/u-icon.vue';
|
|
49
49
|
import { computed } from 'vue';
|
|
50
50
|
import { $u } from '../..';
|
|
51
|
+
import { AlertTipsProps } from './types';
|
|
51
52
|
|
|
52
53
|
defineOptions({
|
|
53
54
|
name: 'u-alert-tips'
|
|
@@ -70,38 +71,8 @@ defineOptions({
|
|
|
70
71
|
* @event {Function} click 点击组件时触发
|
|
71
72
|
* @event {Function} close 点击关闭按钮时触发
|
|
72
73
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const props = defineProps({
|
|
76
|
-
/** 显示文字 */
|
|
77
|
-
title: { type: String, default: '' },
|
|
78
|
-
/** 主题,success/warning/info/error */
|
|
79
|
-
type: { type: String as () => Types, default: 'warning' },
|
|
80
|
-
/** 辅助性文字 */
|
|
81
|
-
description: { type: String, default: '' },
|
|
82
|
-
/** 是否可关闭 */
|
|
83
|
-
closeAble: { type: Boolean, default: false },
|
|
84
|
-
/** 关闭按钮自定义文本 */
|
|
85
|
-
closeText: { type: String, default: '' },
|
|
86
|
-
/** 是否显示图标 */
|
|
87
|
-
showIcon: { type: Boolean, default: false },
|
|
88
|
-
/** 文字颜色,如果定义了color值,icon会失效 */
|
|
89
|
-
color: { type: String, default: '' },
|
|
90
|
-
/** 背景颜色 */
|
|
91
|
-
bgColor: { type: String, default: '' },
|
|
92
|
-
/** 边框颜色 */
|
|
93
|
-
borderColor: { type: String, default: '' },
|
|
94
|
-
/** 是否显示 */
|
|
95
|
-
show: { type: Boolean, default: true },
|
|
96
|
-
/** 左边显示的icon */
|
|
97
|
-
icon: { type: String, default: '' },
|
|
98
|
-
/** icon的样式 */
|
|
99
|
-
iconStyle: { type: Object, default: () => ({}) },
|
|
100
|
-
/** 标题的样式 */
|
|
101
|
-
titleStyle: { type: Object, default: () => ({}) },
|
|
102
|
-
/** 描述文字的样式 */
|
|
103
|
-
descStyle: { type: Object, default: () => ({}) }
|
|
104
|
-
});
|
|
74
|
+
|
|
75
|
+
const props = defineProps(AlertTipsProps);
|
|
105
76
|
|
|
106
77
|
const emit = defineEmits(['click', 'close']);
|
|
107
78
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
|
+
import type { ImgMode } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
// u-avatar 组件 props
|
|
5
|
+
export const AvatarProps = {
|
|
6
|
+
/** 背景颜色 */
|
|
7
|
+
bgColor: { type: String, default: 'transparent' },
|
|
8
|
+
/** 头像路径 */
|
|
9
|
+
src: { type: String, default: '' },
|
|
10
|
+
/** 尺寸,large-大,default-中等,mini-小,如果为数值,则单位为rpx,宽度等于高度 */
|
|
11
|
+
size: { type: [String, Number], default: 'default' },
|
|
12
|
+
/** 头像模型,square-带圆角方形,circle-圆形 */
|
|
13
|
+
mode: { type: String, default: 'circle' },
|
|
14
|
+
/** 文字内容 */
|
|
15
|
+
text: { type: String, default: '' },
|
|
16
|
+
/** 图片的裁剪模型 */
|
|
17
|
+
imgMode: { type: String as PropType<ImgMode>, default: 'aspectFill' },
|
|
18
|
+
/** 标识符 */
|
|
19
|
+
index: { type: [String, Number], default: '' },
|
|
20
|
+
/** 右上角性别角标,man-男,woman-女 */
|
|
21
|
+
sexIcon: { type: String as PropType<'man' | 'woman'>, default: 'man' },
|
|
22
|
+
/** 右下角的等级图标 */
|
|
23
|
+
levelIcon: { type: String, default: 'level' },
|
|
24
|
+
/** 右下角等级图标背景颜色 */
|
|
25
|
+
levelBgColor: { type: String, default: '' },
|
|
26
|
+
/** 右上角性别图标的背景颜色 */
|
|
27
|
+
sexBgColor: { type: String, default: '' },
|
|
28
|
+
/** 是否显示性别图标 */
|
|
29
|
+
showSex: { type: Boolean, default: false },
|
|
30
|
+
/** 是否显示等级图标 */
|
|
31
|
+
showLevel: { type: Boolean, default: false }
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type AvatarProps = ExtractPropTypes<typeof AvatarProps>;
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
16
|
import { ref, computed, watch } from 'vue';
|
|
17
|
+
import { AvatarProps } from './types';
|
|
17
18
|
|
|
18
19
|
defineOptions({
|
|
19
20
|
name: 'u-avatar'
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
let base64Avatar =
|
|
23
|
-
'data:image/jpg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QMraHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZC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AAAAAAAy5W442PVN+K59EePp5ARMvOv5MvO6QXCC4AZwAAAAAAAAAAAAAcxlKLUotprg1owN+PvORborq+7Hnwl3gUbO74VzRydt8pKn68ANcJwmqwkpLmnUDkAAAAfNy9atqtyagut0AxXt5xIV8Fbj6lRd7Am5G65V6qUvtwfyx94GMAAAAAAAAAAAAAAAAAAAOU2nVOj5gdsc3LiqRvTpyqwOxbnnrhdfpSfrQB7pnv/AGvuS9gHXPMy5/Fem1yq0v0A6W29XqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//Z';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* avatar 头像
|
|
@@ -41,35 +42,7 @@ let base64Avatar =
|
|
|
41
42
|
* @event {Function} click 头像被点击
|
|
42
43
|
* @example <u-avatar :src="src"></u-avatar>
|
|
43
44
|
*/
|
|
44
|
-
const props = defineProps(
|
|
45
|
-
/** 背景颜色 */
|
|
46
|
-
bgColor: { type: String, default: 'transparent' },
|
|
47
|
-
/** 头像路径 */
|
|
48
|
-
src: { type: String, default: '' },
|
|
49
|
-
/** 尺寸,large-大,default-中等,mini-小,如果为数值,则单位为rpx,宽度等于高度 */
|
|
50
|
-
size: { type: [String, Number], default: 'default' },
|
|
51
|
-
/** 头像模型,square-带圆角方形,circle-圆形 */
|
|
52
|
-
mode: { type: String, default: 'circle' },
|
|
53
|
-
/** 文字内容 */
|
|
54
|
-
text: { type: String, default: '' },
|
|
55
|
-
/** 图片的裁剪模型 */
|
|
56
|
-
imgMode: { type: String, default: 'aspectFill' },
|
|
57
|
-
/** 标识符 */
|
|
58
|
-
index: { type: [String, Number], default: '' },
|
|
59
|
-
/** 右上角性别角标,man-男,woman-女 */
|
|
60
|
-
sexIcon: { type: String, default: 'man' },
|
|
61
|
-
/** 右下角的等级图标 */
|
|
62
|
-
levelIcon: { type: String, default: 'level' },
|
|
63
|
-
/** 右下角等级图标背景颜色 */
|
|
64
|
-
levelBgColor: { type: String, default: '' },
|
|
65
|
-
/** 右上角性别图标的背景颜色 */
|
|
66
|
-
sexBgColor: { type: String, default: '' },
|
|
67
|
-
/** 是否显示性别图标 */
|
|
68
|
-
showSex: { type: Boolean, default: false },
|
|
69
|
-
/** 是否显示等级图标 */
|
|
70
|
-
showLevel: { type: Boolean, default: false }
|
|
71
|
-
});
|
|
72
|
-
|
|
45
|
+
const props = defineProps(AvatarProps);
|
|
73
46
|
const emit = defineEmits(['click']);
|
|
74
47
|
|
|
75
48
|
// 头像的地址,因为如果加载错误,需要赋值为默认图片,props值无法修改,所以需要一个中间值
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
|
+
import type { AvatarCropperBoundStyle } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
export const AvatarCropperProps = {
|
|
5
|
+
/** 裁剪矩形框的样式 */
|
|
6
|
+
boundStyle: {
|
|
7
|
+
type: Object as PropType<AvatarCropperBoundStyle>,
|
|
8
|
+
default: (): AvatarCropperBoundStyle => ({
|
|
9
|
+
lineWidth: 4,
|
|
10
|
+
borderColor: 'rgb(245, 245, 245)',
|
|
11
|
+
mask: 'rgba(0, 0, 0, 0.35)'
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
// 其他 props 可参考注释,后续如需开放直接补充
|
|
15
|
+
// rectWidth: { type: [String, Number], default: 400 },
|
|
16
|
+
// rectHeight: { type: [String, Number], default: 400 },
|
|
17
|
+
// destWidth: { type: [String, Number], default: 400 },
|
|
18
|
+
// destHeight: { type: [String, Number], default: 400 },
|
|
19
|
+
// fileType: { type: String, default: 'jpg' },
|
|
20
|
+
// quality: { type: [Number, String], default: 1 }
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type AvatarCropperProps = ExtractPropTypes<typeof AvatarCropperProps>;
|
|
@@ -43,6 +43,7 @@ import { ref, reactive, onMounted } from 'vue';
|
|
|
43
43
|
import { $u } from '../..';
|
|
44
44
|
// 兼容 UMD/ESM 导入 weCropper.js
|
|
45
45
|
import WeCropper from './weCropper';
|
|
46
|
+
import { AvatarCropperProps } from './types';
|
|
46
47
|
|
|
47
48
|
defineOptions({ name: 'u-avatar-cropper' });
|
|
48
49
|
|
|
@@ -50,51 +51,7 @@ defineOptions({ name: 'u-avatar-cropper' });
|
|
|
50
51
|
* 裁剪矩形框的样式,其中可包含的属性为lineWidth-边框宽度(单位rpx),color: 边框颜色,
|
|
51
52
|
* mask-遮罩颜色,一般设置为一个rgba的透明度,如"rgba(0, 0, 0, 0.35)"
|
|
52
53
|
*/
|
|
53
|
-
const props = defineProps(
|
|
54
|
-
boundStyle: {
|
|
55
|
-
type: Object as () => {
|
|
56
|
-
lineWidth: number;
|
|
57
|
-
borderColor: string;
|
|
58
|
-
mask: string;
|
|
59
|
-
},
|
|
60
|
-
default: () => ({
|
|
61
|
-
lineWidth: 4,
|
|
62
|
-
borderColor: 'rgb(245, 245, 245)',
|
|
63
|
-
mask: 'rgba(0, 0, 0, 0.35)'
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
// // 裁剪框宽度,单位rpx
|
|
67
|
-
// rectWidth: {
|
|
68
|
-
// type: [String, Number],
|
|
69
|
-
// default: 400
|
|
70
|
-
// },
|
|
71
|
-
// // 裁剪框高度,单位rpx
|
|
72
|
-
// rectHeight: {
|
|
73
|
-
// type: [String, Number],
|
|
74
|
-
// default: 400
|
|
75
|
-
// },
|
|
76
|
-
// // 输出图片宽度,单位rpx
|
|
77
|
-
// destWidth: {
|
|
78
|
-
// type: [String, Number],
|
|
79
|
-
// default: 400
|
|
80
|
-
// },
|
|
81
|
-
// // 输出图片高度,单位rpx
|
|
82
|
-
// destHeight: {
|
|
83
|
-
// type: [String, Number],
|
|
84
|
-
// default: 400
|
|
85
|
-
// },
|
|
86
|
-
// // 输出的图片类型,如果发现裁剪的图片很大,可能是因为设置为了"png",改成"jpg"即可
|
|
87
|
-
// fileType: {
|
|
88
|
-
// type: String,
|
|
89
|
-
// default: 'jpg',
|
|
90
|
-
// },
|
|
91
|
-
// // 生成的图片质量
|
|
92
|
-
// // H5上无效,目前不考虑使用此参数
|
|
93
|
-
// quality: {
|
|
94
|
-
// type: [Number, String],
|
|
95
|
-
// default: 1
|
|
96
|
-
// }
|
|
97
|
-
});
|
|
54
|
+
const props = defineProps(AvatarCropperProps);
|
|
98
55
|
|
|
99
56
|
/**
|
|
100
57
|
* 组合式API变量声明
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
|
+
import type { Shape } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
// u-back-top 组件 props
|
|
5
|
+
export const BackTopProps = {
|
|
6
|
+
/** 返回顶部的形状,circle-圆形,square-方形 */
|
|
7
|
+
mode: { type: String as PropType<Shape>, default: 'circle' },
|
|
8
|
+
/** 自定义图标 */
|
|
9
|
+
icon: { type: String, default: 'arrow-upward' },
|
|
10
|
+
/** 提示文字 */
|
|
11
|
+
tips: { type: String, default: '' },
|
|
12
|
+
/** 返回顶部滚动时间 */
|
|
13
|
+
duration: { type: [Number, String], default: 100 },
|
|
14
|
+
/** 滚动距离 */
|
|
15
|
+
scrollTop: { type: [Number, String], default: 0 },
|
|
16
|
+
/** 距离顶部多少距离显示,单位rpx */
|
|
17
|
+
top: { type: [Number, String], default: 400 },
|
|
18
|
+
/** 返回顶部按钮到底部的距离,单位rpx */
|
|
19
|
+
bottom: { type: [Number, String], default: 200 },
|
|
20
|
+
/** 返回顶部按钮到右边的距离,单位rpx */
|
|
21
|
+
right: { type: [Number, String], default: 40 },
|
|
22
|
+
/** 层级 */
|
|
23
|
+
zIndex: { type: [Number, String], default: '9' },
|
|
24
|
+
/** 图标的样式,对象形式 */
|
|
25
|
+
iconStyle: {
|
|
26
|
+
type: Object as PropType<Record<string, any>>,
|
|
27
|
+
default: () => ({
|
|
28
|
+
color: '#909399',
|
|
29
|
+
fontSize: '38rpx'
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
/** 整个组件的样式 */
|
|
33
|
+
customStyle: {
|
|
34
|
+
type: Object as PropType<Record<string, any>>,
|
|
35
|
+
default: () => ({})
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type BackTopProps = ExtractPropTypes<typeof BackTopProps>;
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
<script setup lang="ts">
|
|
28
28
|
import { ref, computed, watch, useSlots } from 'vue';
|
|
29
|
+
import { BackTopProps } from './types';
|
|
29
30
|
|
|
30
31
|
defineOptions({
|
|
31
32
|
name: 'u-back-top'
|
|
@@ -46,39 +47,7 @@ defineOptions({
|
|
|
46
47
|
* @property {Object} iconStyle 图标的样式,对象形式
|
|
47
48
|
* @property {Object} customStyle 整个组件的样式
|
|
48
49
|
*/
|
|
49
|
-
const props = defineProps(
|
|
50
|
-
/** 返回顶部的形状,circle-圆形,square-方形 */
|
|
51
|
-
mode: { type: String, default: 'circle' },
|
|
52
|
-
/** 自定义图标 */
|
|
53
|
-
icon: { type: String, default: 'arrow-upward' },
|
|
54
|
-
/** 提示文字 */
|
|
55
|
-
tips: { type: String, default: '' },
|
|
56
|
-
/** 返回顶部滚动时间 */
|
|
57
|
-
duration: { type: [Number, String], default: 100 },
|
|
58
|
-
/** 滚动距离 */
|
|
59
|
-
scrollTop: { type: [Number, String], default: 0 },
|
|
60
|
-
/** 距离顶部多少距离显示,单位rpx */
|
|
61
|
-
top: { type: [Number, String], default: 400 },
|
|
62
|
-
/** 返回顶部按钮到底部的距离,单位rpx */
|
|
63
|
-
bottom: { type: [Number, String], default: 200 },
|
|
64
|
-
/** 返回顶部按钮到右边的距离,单位rpx */
|
|
65
|
-
right: { type: [Number, String], default: 40 },
|
|
66
|
-
/** 层级 */
|
|
67
|
-
zIndex: { type: [Number, String], default: '9' },
|
|
68
|
-
/** 图标的样式,对象形式 */
|
|
69
|
-
iconStyle: {
|
|
70
|
-
type: Object,
|
|
71
|
-
default: () => ({
|
|
72
|
-
color: '#909399',
|
|
73
|
-
fontSize: '38rpx'
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
/** 整个组件的样式 */
|
|
77
|
-
customStyle: {
|
|
78
|
-
type: Object,
|
|
79
|
-
default: () => ({})
|
|
80
|
-
}
|
|
81
|
-
});
|
|
50
|
+
const props = defineProps(BackTopProps);
|
|
82
51
|
|
|
83
52
|
const slots = useSlots();
|
|
84
53
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
|
+
import type { BadgeSize, ThemeType } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* badge 角标类型定义
|
|
6
|
+
* @description 供 u-badge 组件 props 使用
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const BadgeProps = {
|
|
10
|
+
/** 使用预设的背景颜色 primary,warning,success,error,info */
|
|
11
|
+
type: { type: String as PropType<ThemeType>, default: 'error' },
|
|
12
|
+
/** Badge的尺寸,default, mini */
|
|
13
|
+
size: { type: String as PropType<BadgeSize>, default: 'default' },
|
|
14
|
+
/** 是否是圆点 */
|
|
15
|
+
isDot: { type: Boolean, default: false },
|
|
16
|
+
/** 显示的数值内容 */
|
|
17
|
+
count: { type: [Number, String], default: undefined },
|
|
18
|
+
/** 展示封顶的数字值 */
|
|
19
|
+
overflowCount: { type: Number, default: 99 },
|
|
20
|
+
/** 当数值为 0 时,是否展示 Badge */
|
|
21
|
+
showZero: { type: Boolean, default: false },
|
|
22
|
+
/** 位置偏移 [number, number] */
|
|
23
|
+
offset: { type: Array as unknown as PropType<[number, number]>, default: () => [20, 20] },
|
|
24
|
+
/** 是否开启绝对定位,开启了offset才会起作用 */
|
|
25
|
+
absolute: { type: Boolean, default: true },
|
|
26
|
+
/** 字体大小 */
|
|
27
|
+
fontSize: { type: [String, Number], default: '24' },
|
|
28
|
+
/** 字体颜色 */
|
|
29
|
+
color: { type: String, default: '#ffffff' },
|
|
30
|
+
/** badge的背景颜色 */
|
|
31
|
+
bgColor: { type: String, default: '' },
|
|
32
|
+
/** 是否让badge组件的中心点和父组件右上角重合,配置的话,offset将会失效 */
|
|
33
|
+
isCenter: { type: Boolean, default: false }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type BadgeProps = ExtractPropTypes<typeof BadgeProps>;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<script setup lang="ts">
|
|
23
23
|
import { computed } from 'vue';
|
|
24
|
+
import { BadgeProps } from './types';
|
|
24
25
|
|
|
25
26
|
defineOptions({
|
|
26
27
|
name: 'u-badge'
|
|
@@ -44,32 +45,7 @@ defineOptions({
|
|
|
44
45
|
* @example <u-badge type="error" count="7"></u-badge>
|
|
45
46
|
*/
|
|
46
47
|
|
|
47
|
-
const props = defineProps(
|
|
48
|
-
/** 使用预设的背景颜色 primary,warning,success,error,info */
|
|
49
|
-
type: { type: String, default: 'error' },
|
|
50
|
-
/** Badge的尺寸,default, mini */
|
|
51
|
-
size: { type: String, default: 'default' },
|
|
52
|
-
/** 是否是圆点 */
|
|
53
|
-
isDot: { type: Boolean, default: false },
|
|
54
|
-
/** 显示的数值内容 */
|
|
55
|
-
count: { type: [Number, String], default: undefined },
|
|
56
|
-
/** 展示封顶的数字值 */
|
|
57
|
-
overflowCount: { type: Number, default: 99 },
|
|
58
|
-
/** 当数值为 0 时,是否展示 Badge */
|
|
59
|
-
showZero: { type: Boolean, default: false },
|
|
60
|
-
/** 位置偏移 [number, number] */
|
|
61
|
-
offset: { type: [Array, Object], default: () => [20, 20] },
|
|
62
|
-
/** 是否开启绝对定位,开启了offset才会起作用 */
|
|
63
|
-
absolute: { type: Boolean, default: true },
|
|
64
|
-
/** 字体大小 */
|
|
65
|
-
fontSize: { type: [String, Number], default: '24' },
|
|
66
|
-
/** 字体颜色 */
|
|
67
|
-
color: { type: String, default: '#ffffff' },
|
|
68
|
-
/** badge的背景颜色 */
|
|
69
|
-
bgColor: { type: String, default: '' },
|
|
70
|
-
/** 是否让badge组件的中心点和父组件右上角重合,配置的话,offset将会失效 */
|
|
71
|
-
isCenter: { type: Boolean, default: false }
|
|
72
|
-
});
|
|
48
|
+
const props = defineProps(BadgeProps);
|
|
73
49
|
|
|
74
50
|
/**
|
|
75
51
|
* 计算 badge 的定位和变换样式
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { ButtonFormType, ButtonOpenType, ButtonScope, ButtonSize, ButtonType, Shape } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* button 按钮类型定义
|
|
6
|
+
* @description 供 u-button 组件 props 使用
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const ButtonProps = {
|
|
10
|
+
/** 是否细边框 */
|
|
11
|
+
hairLine: { type: Boolean, default: true },
|
|
12
|
+
/** 按钮的预置样式,default,primary,error,warning,success */
|
|
13
|
+
type: { type: String as PropType<ButtonType>, default: 'default' },
|
|
14
|
+
/** 按钮尺寸,default,medium,mini */
|
|
15
|
+
size: { type: String as PropType<ButtonSize>, default: 'default' },
|
|
16
|
+
/** 按钮形状,circle(两边为半圆),square(带圆角) */
|
|
17
|
+
shape: { type: String as PropType<Shape>, default: 'square' },
|
|
18
|
+
/** 按钮是否镂空 */
|
|
19
|
+
plain: { type: Boolean, default: false },
|
|
20
|
+
/** 是否禁止状态 */
|
|
21
|
+
disabled: { type: Boolean, default: false },
|
|
22
|
+
/** 是否加载中 */
|
|
23
|
+
loading: { type: Boolean, default: false },
|
|
24
|
+
/** 支付宝小程序,当 open-type 为 getAuthorize 时有效 */
|
|
25
|
+
scope: { type: String as PropType<ButtonScope>, default: '' },
|
|
26
|
+
/** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
|
|
27
|
+
openType: { type: String as PropType<ButtonOpenType>, default: '' },
|
|
28
|
+
/** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
|
|
29
|
+
formType: { type: String as PropType<ButtonFormType>, default: '' },
|
|
30
|
+
/** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 */
|
|
31
|
+
appParameter: { type: String, default: '' },
|
|
32
|
+
/** 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 */
|
|
33
|
+
hoverStopPropagation: { type: Boolean, default: false },
|
|
34
|
+
/** 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效 */
|
|
35
|
+
lang: { type: String, default: 'en' },
|
|
36
|
+
/** 会话来源,open-type="contact"时有效。只微信小程序有效 */
|
|
37
|
+
sessionFrom: { type: String, default: '' },
|
|
38
|
+
/** 会话内消息卡片标题,open-type="contact"时有效 */
|
|
39
|
+
sendMessageTitle: { type: String, default: '' },
|
|
40
|
+
/** 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效 */
|
|
41
|
+
sendMessagePath: { type: String, default: '' },
|
|
42
|
+
/** 会话内消息卡片图片,open-type="contact"时有效 */
|
|
43
|
+
sendMessageImg: { type: String, default: '' },
|
|
44
|
+
/** 是否显示会话内消息卡片,open-type="contact"时有效 */
|
|
45
|
+
showMessageCard: { type: Boolean, default: false },
|
|
46
|
+
/** 手指按(触摸)按钮时按钮时的背景颜色 */
|
|
47
|
+
hoverBgColor: { type: String, default: '' },
|
|
48
|
+
/** 水波纹的背景颜色 */
|
|
49
|
+
rippleBgColor: { type: String, default: '' },
|
|
50
|
+
/** 是否开启水波纹效果 */
|
|
51
|
+
ripple: { type: Boolean, default: false },
|
|
52
|
+
/** 按下的类名 */
|
|
53
|
+
hoverClass: { type: String, default: '' },
|
|
54
|
+
/** 自定义样式,对象形式 */
|
|
55
|
+
customStyle: { type: Object as PropType<Record<string, any>>, default: () => ({}) },
|
|
56
|
+
/** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
|
|
57
|
+
dataName: { type: String, default: '' },
|
|
58
|
+
/** 节流,一定时间内只能触发一次 */
|
|
59
|
+
throttleTime: { type: [String, Number], default: 1000 },
|
|
60
|
+
/** 按住后多久出现点击态,单位毫秒 */
|
|
61
|
+
hoverStartTime: { type: [String, Number], default: 20 },
|
|
62
|
+
/** 手指松开后点击态保留时间,单位毫秒 */
|
|
63
|
+
hoverStayTime: { type: [String, Number], default: 150 }
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type ButtonProps = ExtractPropTypes<typeof ButtonProps>;
|