diff --git a/packages/uploader/README.md b/packages/uploader/README.md index 7c1b9d3f..3ab03be5 100644 --- a/packages/uploader/README.md +++ b/packages/uploader/README.md @@ -167,6 +167,7 @@ uploadFilePromise(fileName, chooseResult) { |-----------|-----------|-----------|-----------|-----------| | name | 标识符,可以在回调函数的第二项参数中获取 | *string \| number* | - | - | | accept | 接受的文件类型, 可选值为`all` `image` `file` | *string* | `image` | - | +| sizeType | 所选的图片的尺寸, 当`accept`为`image`类型时设置所选图片的尺寸可选值为`original` `compressed`| *string[]* | `['original','compressed']` | - | | preview-size | 预览图和上传区域的尺寸,默认单位为`px` | *string \| number* | `80px` | - | | preview-image | 是否在上传完成后展示预览图 | *boolean* | `true` | - | | preview-full-image | 是否在点击预览图后展示全屏图片预览 | *boolean* | `true` | - | diff --git a/packages/uploader/index.ts b/packages/uploader/index.ts index f966fcfb..18a51145 100644 --- a/packages/uploader/index.ts +++ b/packages/uploader/index.ts @@ -19,6 +19,10 @@ VantComponent({ type: String, value: 'image' }, + sizeType: { + type: Array, + value: ['original', 'compressed'] + }, capture: { type: Array, value: ['album', 'camera'] @@ -80,6 +84,7 @@ VantComponent({ multiple, maxSize, accept, + sizeType, lists, useBeforeRead = false // 是否定义了 beforeRead } = this.data; @@ -92,6 +97,7 @@ VantComponent({ wx.chooseImage({ count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1, // 最多可以选择的数量,如果不支持多选则数量为1 sourceType: capture, // 选择图片的来源,相册还是相机 + sizeType, success: resolve, fail: reject });