mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Uploader): add sizeType Attribute (#2563)
* feat(Uploader): add sizeType Attribute * feat(Uploader): Uploader组件sizeType 类型修改 * feat(Uploader): fix defaultd value
This commit is contained in:
parent
448bf72598
commit
2dbabe7bf3
@ -167,6 +167,7 @@ uploadFilePromise(fileName, chooseResult) {
|
|||||||
|-----------|-----------|-----------|-----------|-----------|
|
|-----------|-----------|-----------|-----------|-----------|
|
||||||
| name | 标识符,可以在回调函数的第二项参数中获取 | *string \| number* | - | - |
|
| name | 标识符,可以在回调函数的第二项参数中获取 | *string \| number* | - | - |
|
||||||
| accept | 接受的文件类型, 可选值为`all` `image` `file` | *string* | `image` | - |
|
| accept | 接受的文件类型, 可选值为`all` `image` `file` | *string* | `image` | - |
|
||||||
|
| sizeType | 所选的图片的尺寸, 当`accept`为`image`类型时设置所选图片的尺寸可选值为`original` `compressed`| *string[]* | `['original','compressed']` | - |
|
||||||
| preview-size | 预览图和上传区域的尺寸,默认单位为`px` | *string \| number* | `80px` | - |
|
| preview-size | 预览图和上传区域的尺寸,默认单位为`px` | *string \| number* | `80px` | - |
|
||||||
| preview-image | 是否在上传完成后展示预览图 | *boolean* | `true` | - |
|
| preview-image | 是否在上传完成后展示预览图 | *boolean* | `true` | - |
|
||||||
| preview-full-image | 是否在点击预览图后展示全屏图片预览 | *boolean* | `true` | - |
|
| preview-full-image | 是否在点击预览图后展示全屏图片预览 | *boolean* | `true` | - |
|
||||||
|
@ -19,6 +19,10 @@ VantComponent({
|
|||||||
type: String,
|
type: String,
|
||||||
value: 'image'
|
value: 'image'
|
||||||
},
|
},
|
||||||
|
sizeType: {
|
||||||
|
type: Array,
|
||||||
|
value: ['original', 'compressed']
|
||||||
|
},
|
||||||
capture: {
|
capture: {
|
||||||
type: Array,
|
type: Array,
|
||||||
value: ['album', 'camera']
|
value: ['album', 'camera']
|
||||||
@ -80,6 +84,7 @@ VantComponent({
|
|||||||
multiple,
|
multiple,
|
||||||
maxSize,
|
maxSize,
|
||||||
accept,
|
accept,
|
||||||
|
sizeType,
|
||||||
lists,
|
lists,
|
||||||
useBeforeRead = false // 是否定义了 beforeRead
|
useBeforeRead = false // 是否定义了 beforeRead
|
||||||
} = this.data;
|
} = this.data;
|
||||||
@ -92,6 +97,7 @@ VantComponent({
|
|||||||
wx.chooseImage({
|
wx.chooseImage({
|
||||||
count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1, // 最多可以选择的数量,如果不支持多选则数量为1
|
count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1, // 最多可以选择的数量,如果不支持多选则数量为1
|
||||||
sourceType: capture, // 选择图片的来源,相册还是相机
|
sourceType: capture, // 选择图片的来源,相册还是相机
|
||||||
|
sizeType,
|
||||||
success: resolve,
|
success: resolve,
|
||||||
fail: reject
|
fail: reject
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user