Skip to content

Commit f6cb13b

Browse files
authored
feat(uploader): add preview-file prop support (#5828)
1 parent e5af691 commit f6cb13b

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

packages/uploader/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ uploadFilePromise(fileName, chooseResult) {
230230
| preview-size | 预览图和上传区域的尺寸,默认单位为`px` | _string \| number_ | `80px` |
231231
| preview-image | 是否在上传完成后展示预览图 | _boolean_ | `true` |
232232
| preview-full-image | 是否在点击预览图后展示全屏图片预览 | _boolean_ | `true` |
233+
| preview-file `v1.11.7` | 是否在点击文件预览图后预览文件 | _boolean_ | `true` |
233234
| multiple | 是否开启图片多选,部分安卓机型不支持 | _boolean_ | `false` |
234235
| disabled | 是否禁用文件上传 | _boolean_ | `false` |
235236
| show-upload | 是否展示文件上传按钮 | _boolean_ | `true` |

packages/uploader/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ VantComponent({
218218
},
219219

220220
onPreviewFile(event: WechatMiniprogram.TouchEvent) {
221+
if (!this.data.previewFile) return;
222+
221223
const { index } = event.currentTarget.dataset;
222224

223225
wx.openDocument({

packages/uploader/shared.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ export const mediaProps = {
6161
// props for file
6262
export const messageFileProps = {
6363
extension: null,
64+
previewFile: {
65+
type: Boolean,
66+
value: true,
67+
},
6468
};

0 commit comments

Comments
 (0)