uview-pro 0.5.18 → 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 CHANGED
@@ -1,3 +1,28 @@
1
+ ## 0.6.0-beta.0(2026-04-30)
2
+
3
+ ### ✨ Features | 新功能
4
+
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))
8
+
9
+ ### ♻️ Code Refactoring | 代码重构
10
+
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))
21
+
22
+ ### 👥 Contributors
23
+
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>
25
+
1
26
  ## 0.5.18(2026-04-22)
2
27
 
3
28
  ### 🐛 Bug Fixes | Bug 修复
@@ -27,8 +27,9 @@
27
27
  color: color,
28
28
  fontSize: fontSize + 'rpx'
29
29
  }"
30
- ><slot
31
- /></view>
30
+ >
31
+ <slot />
32
+ </view>
32
33
  <view
33
34
  class="u-divider-line"
34
35
  :class="[type ? 'u-divider-line--bordercolor--' + type : '']"
@@ -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
- fileList: { type: Array as PropType<any[]>, default: () => [] },
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: () => ['png', 'jpg', 'jpeg', 'webp', 'gif', 'image'] },
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<((index: number, files: any[]) => boolean | Promise<any>) | null>,
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<((index: number, files: any[]) => boolean | Promise<any>) | null>,
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';