uview-pro 0.5.17 → 0.6.0-beta.0
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 +58 -12
- package/components/u-calendar/u-calendar.vue +1 -1
- package/components/u-divider/u-divider.vue +3 -2
- package/components/u-tabbar/u-tabbar.vue +66 -35
- package/components/u-upload/types.ts +78 -9
- package/components/u-upload/u-upload.vue +1168 -230
- package/locale/lang/en-US.ts +8 -2
- package/locale/lang/zh-CN.ts +8 -2
- package/package.json +4 -4
- package/readme.md +239 -239
- package/types/global.d.ts +27 -0
package/changelog.md
CHANGED
|
@@ -1,26 +1,72 @@
|
|
|
1
|
-
## 0.
|
|
2
|
-
|
|
3
|
-
### 🐛 Bug Fixes | Bug 修复
|
|
4
|
-
|
|
5
|
-
- **demo:** 修复topTips组件演示示例在小程序中不弹出的问题,需设置自定义navbar高度 ([0c72d24](https://github.com/anyup/uView-Pro/commit/0c72d24cd77f4ba6b6cb411810fcf5f0bd1d3272))
|
|
6
|
-
- **u-table:** 修复表格表头暗黑模式背景色问题 ([c7fd1a5](https://github.com/anyup/uView-Pro/commit/c7fd1a58e87c4efb84ccf737fe9d1e755908ba8f))
|
|
7
|
-
- **u-alert-tips:** 修复关闭按钮颜色样式问题 ([94001cf](https://github.com/anyup/uView-Pro/commit/94001cf79a03ea75695e414a7971e7ec39f445b6))
|
|
1
|
+
## 0.6.0-beta.0(2026-04-30)
|
|
8
2
|
|
|
9
3
|
### ✨ Features | 新功能
|
|
10
4
|
|
|
11
|
-
- **
|
|
12
|
-
- **u-
|
|
13
|
-
- **
|
|
14
|
-
- **u-calendar:** 统一日期格式YYYY-MM-DD,确保跨组件日期处理的一致性 ([092cc53](https://github.com/anyup/uView-Pro/commit/092cc5392b64990342c43fcbac9aec1bfa2bf982))
|
|
5
|
+
- **u-upload:** 新增多种上传模式和文件类型支持,支持图片、视频、文档等多种类型,支持网格(grid)和列表(list)两种展示模式 ([f75d34c](https://github.com/anyup/uView-Pro/commit/f75d34c22d551c41e8e873bc5779089ff2b2c0c7))
|
|
6
|
+
- **u-upload:** 新增 v-model 支持并优化文件列表同步逻辑 ([5548d84](https://github.com/anyup/uView-Pro/commit/5548d847b5c442da40775ec06ecfab7f0fddf448))
|
|
7
|
+
- **upload:** 完善上传组件示例页面功能,添加多种上传模式示例:图片上传(网格模式)、文件上传(列表模式)、视频上传 ([d43b3d2](https://github.com/anyup/uView-Pro/commit/d43b3d2c7f0ff7a7fe45467d49d451ca878b7eb1))
|
|
15
8
|
|
|
16
9
|
### ♻️ Code Refactoring | 代码重构
|
|
17
10
|
|
|
18
|
-
- **u-
|
|
11
|
+
- **u-divider:** 规范化 slot 标签 ([fccac33](https://github.com/anyup/uView-Pro/commit/fccac33b6adce3395179d5c55b7b8a0a4d25a800))
|
|
12
|
+
|
|
13
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
14
|
+
|
|
15
|
+
- **u-upload:** 优化微信小程序平台监听文件列表变化不触发on-list-change事件的场景 ([47fa5c1](https://github.com/anyup/uView-Pro/commit/47fa5c1dfa30214dfc40f7ee01b09f6f95d09b9a))
|
|
16
|
+
- **changelog:** 修复版本标题格式和Unreleased区块处理 ([3a87f47](https://github.com/anyup/uView-Pro/commit/3a87f4739cdebc1aafcb33e3f9b31dd79f9bc3d2))
|
|
17
|
+
|
|
18
|
+
### 👷 Continuous Integration | CI 配置
|
|
19
|
+
|
|
20
|
+
- 增强预发布版本支持和发布管理功能 ([86abdaa](https://github.com/anyup/uView-Pro/commit/86abdaad6a618dfa42416138f05baf910f52fba5))
|
|
19
21
|
|
|
20
22
|
### 👥 Contributors
|
|
21
23
|
|
|
22
24
|
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
23
25
|
|
|
26
|
+
## 0.5.18(2026-04-22)
|
|
27
|
+
|
|
28
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
29
|
+
|
|
30
|
+
- **u-calendar:** 修复农历数据响应式访问问题 ([0a88b13](https://github.com/anyup/uView-Pro/commit/0a88b13911fc8c47229f5d9cab0fdfc8ade09ecb))
|
|
31
|
+
- **mp-weixin:** 修复微信小程序演示示例vue-i18n多语言切换后uni.getLocale()始终获取中文的问题 ([30b811f](https://github.com/anyup/uView-Pro/commit/30b811f85db29165cd150bea380dfe44f94fda79))
|
|
32
|
+
- **demo:** 取消底部导航标题配置设置国际化文案 ([7b949ab](https://github.com/anyup/uView-Pro/commit/7b949ab8695fbc3d9db51b96da1b25a1f05c2ed3))
|
|
33
|
+
- **demo:** 修复日历组件demo切换逻辑 ([9aa706a](https://github.com/anyup/uView-Pro/commit/9aa706a0e7b564c2bef75d1d6e7a90023dfc1c17))
|
|
34
|
+
|
|
35
|
+
### ✨ Features | 新功能
|
|
36
|
+
|
|
37
|
+
- **u-tabbar:** 底部导航栏支持自定义item宽度配置,优化item平分功能 ([997846f](https://github.com/anyup/uView-Pro/commit/997846fb5f8ba4648e4d0514f0846ce80a217490))
|
|
38
|
+
|
|
39
|
+
### 📝 Documentation | 文档
|
|
40
|
+
|
|
41
|
+
- update uview pro desc ([ba65d2e](https://github.com/anyup/uView-Pro/commit/ba65d2e34a1e620b595122a81df48a333c97bbcd))
|
|
42
|
+
|
|
43
|
+
### 👥 Contributors
|
|
44
|
+
|
|
45
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
46
|
+
|
|
47
|
+
## 0.5.17(2026-04-15)
|
|
48
|
+
|
|
49
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
50
|
+
|
|
51
|
+
- **demo:** 修复topTips组件演示示例在小程序中不弹出的问题,需设置自定义navbar高度 ([0c72d24](https://github.com/anyup/uView-Pro/commit/0c72d24cd77f4ba6b6cb411810fcf5f0bd1d3272))
|
|
52
|
+
- **u-table:** 修复表格表头暗黑模式背景色问题 ([c7fd1a5](https://github.com/anyup/uView-Pro/commit/c7fd1a58e87c4efb84ccf737fe9d1e755908ba8f))
|
|
53
|
+
- **u-alert-tips:** 修复关闭按钮颜色样式问题 ([94001cf](https://github.com/anyup/uView-Pro/commit/94001cf79a03ea75695e414a7971e7ec39f445b6))
|
|
54
|
+
|
|
55
|
+
### ✨ Features | 新功能
|
|
56
|
+
|
|
57
|
+
- **theme:** 更新主题配置和本地化文本 ([4caa2ed](https://github.com/anyup/uView-Pro/commit/4caa2edf9542f7f2b0a7bb9870585390f0241e80))
|
|
58
|
+
- **u-calendar:** 增强日历组件功能,支持多种日历模式:打卡签到、节假日标记、价格日历等场景,支持自定义插槽功能,动态价格显示;支持选中日期,只读模式设置;修复范围选择背景色样式问题 ([7a9250e](https://github.com/anyup/uView-Pro/commit/7a9250eb49f6694286bb0c3dad7bc9780ae95864))
|
|
59
|
+
- **u-popup:** 新增inline模式支持,允许弹窗组件直接插入页面内容而非传统弹窗形式 ([2e8890c](https://github.com/anyup/uView-Pro/commit/2e8890ca3c9cacb90739b33cb0e38db7e2bdb473))
|
|
60
|
+
- **u-calendar:** 统一日期格式YYYY-MM-DD,确保跨组件日期处理的一致性 ([092cc53](https://github.com/anyup/uView-Pro/commit/092cc5392b64990342c43fcbac9aec1bfa2bf982))
|
|
61
|
+
|
|
62
|
+
### ♻️ Code Refactoring | 代码重构
|
|
63
|
+
|
|
64
|
+
- **u-calendar:** 重构日历组件模板,统一页面和弹窗模式的日历组件结构 ([42894b8](https://github.com/anyup/uView-Pro/commit/42894b850f903e2471ca42e02f0379443139838b))
|
|
65
|
+
|
|
66
|
+
### 👥 Contributors
|
|
67
|
+
|
|
68
|
+
<a href="https://github.com/anyup"><img src="https://github.com/anyup.png?size=40" width="40" height="40" alt="anyup" title="anyup"/></a>
|
|
69
|
+
|
|
24
70
|
## 0.5.16(2026-03-26)
|
|
25
71
|
|
|
26
72
|
### ✨ Features | 新功能
|
|
@@ -527,7 +527,7 @@ function getDateInfo(dayNum: number) {
|
|
|
527
527
|
isChecked: props.checkedDates.includes(dateStr),
|
|
528
528
|
isSelected,
|
|
529
529
|
isTodayChecked: dateStr === today.value && props.todayChecked,
|
|
530
|
-
lunar: lunarArr[dayNum - 1] || null
|
|
530
|
+
lunar: lunarArr.value[dayNum - 1] || null
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
533
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
:key="index"
|
|
18
18
|
:class="{ 'u-tabbar__content__circle': props.midButton && item.midButton }"
|
|
19
19
|
@tap.stop="clickHandler(index)"
|
|
20
|
-
:style="
|
|
20
|
+
:style="$u.toStyle(getItemStyle(item))"
|
|
21
21
|
>
|
|
22
22
|
<view
|
|
23
23
|
class="u-tabbar__content__item__container"
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
: 'u-tabbar__content__item__icon'
|
|
33
33
|
]"
|
|
34
34
|
>
|
|
35
|
+
<!-- 凸起按钮边框 -->
|
|
36
|
+
<view
|
|
37
|
+
v-if="props.midButton && item.midButton && props.borderTop"
|
|
38
|
+
class="u-tabbar__content__circle__border"
|
|
39
|
+
:style="{ backgroundColor: props.bgColor }"
|
|
40
|
+
></view>
|
|
35
41
|
<u-icon
|
|
36
42
|
:size="getIconSize(index)"
|
|
37
43
|
:name="elIconPath(index)"
|
|
@@ -69,12 +75,6 @@
|
|
|
69
75
|
</view>
|
|
70
76
|
</view>
|
|
71
77
|
</view>
|
|
72
|
-
<view
|
|
73
|
-
v-if="props.midButton"
|
|
74
|
-
class="u-tabbar__content__circle__border"
|
|
75
|
-
:class="{ 'u-border': props.borderTop }"
|
|
76
|
-
:style="{ backgroundColor: props.bgColor, left: midButtonLeft }"
|
|
77
|
-
></view>
|
|
78
78
|
</view>
|
|
79
79
|
<!-- 这里加上一个48rpx的高度,是为了增高有凸起按钮时的防塌陷高度(也即按钮凸出来部分的高度) -->
|
|
80
80
|
<!-- calc 计算0时单位不一致会计算失败,这里+1px -->
|
|
@@ -102,6 +102,7 @@ export default {
|
|
|
102
102
|
import { ref, computed, onMounted } from 'vue';
|
|
103
103
|
import { $u } from '../..';
|
|
104
104
|
import { TabbarProps } from './types';
|
|
105
|
+
import type { TabbarItem } from '../../types/global';
|
|
105
106
|
|
|
106
107
|
/**
|
|
107
108
|
* u-tabbar 底部导航栏
|
|
@@ -128,8 +129,51 @@ const emit = defineEmits<{ (e: 'change', index: number): void; (e: 'update:model
|
|
|
128
129
|
// 计算z-index值
|
|
129
130
|
const uZIndex = computed(() => props?.zIndex ?? $u.zIndex.tabbar);
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
/**
|
|
133
|
+
* 检查是否有任意item设置了width
|
|
134
|
+
*/
|
|
135
|
+
const hasCustomWidth = computed(() => {
|
|
136
|
+
return props.list?.some(item => item.width !== undefined && item.width !== null && item.width !== '') || false;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 计算每个item的宽度,根据list数量平分
|
|
141
|
+
* 如果任意item设置了width,则不自动计算,返回auto
|
|
142
|
+
*/
|
|
143
|
+
const autoItemWidth = computed(() => {
|
|
144
|
+
// 如果用户设置了任意一个width,就不自动计算
|
|
145
|
+
if (hasCustomWidth.value) return 'auto';
|
|
146
|
+
|
|
147
|
+
const count = props.list?.length || 0;
|
|
148
|
+
if (count === 0) return 'auto';
|
|
149
|
+
return `${100 / count}%`;
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 获取单个item的样式
|
|
154
|
+
* 使用 flex 简写属性设置宽度,与原有样式保持一致
|
|
155
|
+
*/
|
|
156
|
+
function getItemStyle(item: TabbarItem): Record<string, any> {
|
|
157
|
+
const style: Record<string, any> = {};
|
|
158
|
+
// 背景色
|
|
159
|
+
style.backgroundColor = props.bgColor;
|
|
160
|
+
// flex宽度设置
|
|
161
|
+
if (item.width !== undefined && item.width !== null && item.width !== '') {
|
|
162
|
+
// 固定宽度:不伸缩
|
|
163
|
+
style.flex = `0 0 ${$u.addUnit(item.width)}`;
|
|
164
|
+
style.width = $u.addUnit(item.width);
|
|
165
|
+
} else if (hasCustomWidth.value) {
|
|
166
|
+
// 如果其他item设置了width,未设置的自动填充剩余空间
|
|
167
|
+
style.flex = '1 1 auto';
|
|
168
|
+
style.width = 'auto';
|
|
169
|
+
} else {
|
|
170
|
+
// 自动平分:不伸缩,按百分比分配
|
|
171
|
+
style.flex = `0 0 ${autoItemWidth.value}`;
|
|
172
|
+
style.width = autoItemWidth.value;
|
|
173
|
+
}
|
|
174
|
+
return style;
|
|
175
|
+
}
|
|
176
|
+
|
|
133
177
|
const pageUrl = ref(''); // 当前页面URL
|
|
134
178
|
|
|
135
179
|
onMounted(() => {
|
|
@@ -140,7 +184,6 @@ onMounted(() => {
|
|
|
140
184
|
const pages = getCurrentPages();
|
|
141
185
|
// 页面栈中的最后一个即为项为当前页面,route属性为页面路径
|
|
142
186
|
pageUrl.value = pages[pages.length - 1].route as string;
|
|
143
|
-
if (props.midButton) getMidButtonLeft();
|
|
144
187
|
});
|
|
145
188
|
|
|
146
189
|
/**
|
|
@@ -303,15 +346,6 @@ function getTextSize(index: number) {
|
|
|
303
346
|
return props.textSize;
|
|
304
347
|
}
|
|
305
348
|
|
|
306
|
-
/**
|
|
307
|
-
* 获取凸起按钮外层元素的left值,让其水平居中
|
|
308
|
-
*/
|
|
309
|
-
function getMidButtonLeft() {
|
|
310
|
-
const windowWidth = $u.sys().windowWidth;
|
|
311
|
-
// 由于安卓中css计算left: 50%的结果不准确,故用js计算
|
|
312
|
-
midButtonLeft.value = windowWidth / 2 + 'px';
|
|
313
|
-
}
|
|
314
|
-
|
|
315
349
|
/**
|
|
316
350
|
* 图标和文字间距
|
|
317
351
|
*/
|
|
@@ -358,22 +392,7 @@ function containerStyle(index: number) {
|
|
|
358
392
|
/* #ifndef APP-NVUE */
|
|
359
393
|
box-sizing: content-box;
|
|
360
394
|
/* #endif */
|
|
361
|
-
|
|
362
|
-
border-radius: 100%;
|
|
363
|
-
width: 130rpx;
|
|
364
|
-
height: 130rpx;
|
|
365
|
-
top: -58rpx;
|
|
366
|
-
position: absolute;
|
|
367
|
-
z-index: 4;
|
|
368
|
-
background-color: var(--u-bg-white);
|
|
369
|
-
// 由于安卓的无能,导致只有3个tabbar item时,此css计算方式有误差
|
|
370
|
-
// 故使用js计算的形式来定位,此处不注释,是因为js计算有延后,避免出现位置闪动
|
|
371
|
-
left: 50%;
|
|
372
|
-
transform: translateX(-50%);
|
|
373
|
-
&:after {
|
|
374
|
-
border-radius: 100px;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
395
|
+
|
|
377
396
|
&__item {
|
|
378
397
|
flex: 1;
|
|
379
398
|
justify-content: center;
|
|
@@ -404,6 +423,7 @@ function containerStyle(index: number) {
|
|
|
404
423
|
line-height: 28rpx;
|
|
405
424
|
text-align: center;
|
|
406
425
|
width: 100%;
|
|
426
|
+
z-index: 6;
|
|
407
427
|
}
|
|
408
428
|
}
|
|
409
429
|
&__circle {
|
|
@@ -440,6 +460,17 @@ function containerStyle(index: number) {
|
|
|
440
460
|
z-index: 6;
|
|
441
461
|
transform: translateX(-50%);
|
|
442
462
|
}
|
|
463
|
+
&__border {
|
|
464
|
+
position: absolute;
|
|
465
|
+
top: -18rpx;
|
|
466
|
+
width: 130rpx;
|
|
467
|
+
height: 130rpx;
|
|
468
|
+
border-radius: 100%;
|
|
469
|
+
border-top: 1px solid var(--u-border-color);
|
|
470
|
+
background-color: var(--u-bg-white);
|
|
471
|
+
z-index: 0;
|
|
472
|
+
pointer-events: none;
|
|
473
|
+
}
|
|
443
474
|
}
|
|
444
475
|
}
|
|
445
476
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import type { ImgMode, UploadSizeType, UploadSourceType } from '../../types/global';
|
|
2
|
+
import type { ImgMode, UploadSizeType, UploadSourceType, UploadAcceptType, UploadFileItem } from '../../types/global';
|
|
3
3
|
import { useLocale } from '../../';
|
|
4
4
|
|
|
5
5
|
const { t } = useLocale();
|
|
@@ -27,6 +27,12 @@ export const UploadProps = {
|
|
|
27
27
|
maxCount: { type: [Number, String] as PropType<number | string>, default: 52 },
|
|
28
28
|
/** 是否可删除 */
|
|
29
29
|
deletable: { type: Boolean, default: true },
|
|
30
|
+
/**
|
|
31
|
+
* 上传组件的展示模式
|
|
32
|
+
* @description grid-网格模式(默认), list-列表模式
|
|
33
|
+
* @default 'grid'
|
|
34
|
+
*/
|
|
35
|
+
mode: { type: String as PropType<'grid' | 'list'>, default: 'grid' },
|
|
30
36
|
/** 是否显示上传列表 */
|
|
31
37
|
showUploadList: { type: Boolean, default: true },
|
|
32
38
|
/** 是否显示上传进度 */
|
|
@@ -61,33 +67,96 @@ export const UploadProps = {
|
|
|
61
67
|
sourceType: { type: Array as PropType<UploadSourceType[]>, default: () => ['album', 'camera'] },
|
|
62
68
|
/** 是否可预览大图 */
|
|
63
69
|
previewFullImage: { type: Boolean, default: true },
|
|
70
|
+
/** 是否可预览文件 */
|
|
71
|
+
previewFile: { type: Boolean, default: true },
|
|
64
72
|
/** 是否支持多选 */
|
|
65
73
|
multiple: { type: Boolean, default: true },
|
|
66
|
-
/** 单个文件最大大小,单位B */
|
|
74
|
+
/** 单个文件最大大小,单位B(byte),默认不限制 */
|
|
67
75
|
maxSize: { type: [Number, String] as PropType<number | string>, default: Number.MAX_VALUE },
|
|
68
|
-
/**
|
|
69
|
-
|
|
76
|
+
/**
|
|
77
|
+
* 文件列表(v-model 双向绑定)
|
|
78
|
+
* @description 推荐使用 v-model 替代 :file-list
|
|
79
|
+
*/
|
|
80
|
+
modelValue: { type: Array as PropType<UploadFileItem[]>, default: () => [] },
|
|
81
|
+
/**
|
|
82
|
+
* 文件列表(初始值,向后兼容)
|
|
83
|
+
* @deprecated 请使用 v-model
|
|
84
|
+
*/
|
|
85
|
+
fileList: { type: Array as PropType<UploadFileItem[]>, default: () => [] },
|
|
70
86
|
/** 限制文件类型 */
|
|
71
|
-
/**
|
|
87
|
+
/** 允许上传的文件后缀 */
|
|
72
88
|
/** 支付宝小程序真机选择图片的后缀为"image" */
|
|
73
89
|
/** https://opendocs.alipay.com/mini/api/media-image */
|
|
74
|
-
limitType: { type: Array as PropType<string[]>, default: () => [
|
|
90
|
+
limitType: { type: Array as PropType<string[]>, default: () => [] },
|
|
75
91
|
/** 是否自动上传 */
|
|
76
92
|
autoUpload: { type: Boolean, default: true },
|
|
77
93
|
/** 是否显示提示 */
|
|
78
94
|
showTips: { type: Boolean, default: true },
|
|
95
|
+
/** 是否显示确认弹窗 */
|
|
96
|
+
showConfirm: { type: Boolean, default: true },
|
|
79
97
|
/** 上传前钩子,返回true或Promise */
|
|
80
98
|
beforeUpload: {
|
|
81
|
-
type: Function as unknown as PropType<
|
|
99
|
+
type: Function as unknown as PropType<
|
|
100
|
+
((index: number, files: UploadFileItem[]) => boolean | Promise<any>) | null
|
|
101
|
+
>,
|
|
82
102
|
default: null
|
|
83
103
|
},
|
|
84
104
|
/** 删除前钩子,返回true或Promise */
|
|
85
105
|
beforeRemove: {
|
|
86
|
-
type: Function as unknown as PropType<
|
|
106
|
+
type: Function as unknown as PropType<
|
|
107
|
+
((index: number, files: UploadFileItem[]) => boolean | Promise<any>) | null
|
|
108
|
+
>,
|
|
87
109
|
default: null
|
|
88
110
|
},
|
|
89
111
|
/** 如果上传后的返回值为json字符串,是否转为json格式 */
|
|
90
|
-
toJson: { type: Boolean, default: true }
|
|
112
|
+
toJson: { type: Boolean, default: true },
|
|
113
|
+
/**
|
|
114
|
+
* 接受上传的文件类型
|
|
115
|
+
* @description image-图片(默认), video-视频, file-文件, media-媒体(图片+视频), all-所有文件
|
|
116
|
+
* @default 'image'
|
|
117
|
+
*/
|
|
118
|
+
accept: { type: String as PropType<UploadAcceptType>, default: 'image' },
|
|
119
|
+
/**
|
|
120
|
+
* 是否显示文件名
|
|
121
|
+
* @default true
|
|
122
|
+
*/
|
|
123
|
+
showFileName: { type: Boolean, default: true },
|
|
124
|
+
/**
|
|
125
|
+
* 是否显示文件大小
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
showFileSize: { type: Boolean, default: false },
|
|
129
|
+
/**
|
|
130
|
+
* 文件类型图标映射配置
|
|
131
|
+
* @description 用于自定义不同文件类型的图标
|
|
132
|
+
*/
|
|
133
|
+
fileIconMap: {
|
|
134
|
+
type: Object as PropType<Record<string, { name: string; color?: string }>>,
|
|
135
|
+
default: () => ({})
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* 选择视频时是否压缩
|
|
139
|
+
* @default true
|
|
140
|
+
*/
|
|
141
|
+
compressed: { type: Boolean, default: true },
|
|
142
|
+
/**
|
|
143
|
+
* 选择视频时拍摄最长时长,单位秒
|
|
144
|
+
* @default 60
|
|
145
|
+
*/
|
|
146
|
+
maxDuration: { type: Number, default: 60 },
|
|
147
|
+
/**
|
|
148
|
+
* 选择视频时,是前置还是后置摄像头
|
|
149
|
+
* @default 'back'
|
|
150
|
+
*/
|
|
151
|
+
camera: { type: String as PropType<'front' | 'back'>, default: 'back' },
|
|
152
|
+
/**
|
|
153
|
+
* 选择文件时的扩展名过滤
|
|
154
|
+
* @description 仅在 accept='file' 或 accept='all' 时有效
|
|
155
|
+
*/
|
|
156
|
+
extension: { type: Array as PropType<string[]>, default: () => [] }
|
|
91
157
|
};
|
|
92
158
|
|
|
93
159
|
export type UploadProps = ExtractPropTypes<typeof UploadProps>;
|
|
160
|
+
|
|
161
|
+
// 重新导出全局类型,方便从组件入口导入
|
|
162
|
+
export type { UploadAcceptType, UploadFileItem } from '../../types/global';
|