Skip to content

Commit

Permalink
feat(uploader): add preview-file prop support (#5828)
Browse files Browse the repository at this point in the history
  • Loading branch information
landluck authored Jun 24, 2024
1 parent e5af691 commit f6cb13b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/uploader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ uploadFilePromise(fileName, chooseResult) {
| preview-size | 预览图和上传区域的尺寸,默认单位为`px` | _string \| number_ | `80px` |
| preview-image | 是否在上传完成后展示预览图 | _boolean_ | `true` |
| preview-full-image | 是否在点击预览图后展示全屏图片预览 | _boolean_ | `true` |
| preview-file `v1.11.7` | 是否在点击文件预览图后预览文件 | _boolean_ | `true` |
| multiple | 是否开启图片多选,部分安卓机型不支持 | _boolean_ | `false` |
| disabled | 是否禁用文件上传 | _boolean_ | `false` |
| show-upload | 是否展示文件上传按钮 | _boolean_ | `true` |
Expand Down
2 changes: 2 additions & 0 deletions packages/uploader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ VantComponent({
},

onPreviewFile(event: WechatMiniprogram.TouchEvent) {
if (!this.data.previewFile) return;

const { index } = event.currentTarget.dataset;

wx.openDocument({
Expand Down
4 changes: 4 additions & 0 deletions packages/uploader/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ export const mediaProps = {
// props for file
export const messageFileProps = {
extension: null,
previewFile: {
type: Boolean,
value: true,
},
};

0 comments on commit f6cb13b

Please sign in to comment.